in reply to Re: Current download information..
in thread Current download information..

I'm useing LWP::UserAgent, and $resp is the responce from a http GET from my program. Here is a bigger picture of my code..
$hdrs = new HTTP::Headers(Accept => 'application/octet-stream', User_Agent => 'my program'); $url = new URI::URL($FileURL); ## $FileURL might hold - http://www.wha +tever.com/me.jpg $req = new HTTP::Request('GET', $url, $hdrs); $ua = new LWP::UserAgent; $ua->timeout($WaitState); ## $WaitState holds a number $resp = $ua->request($req); if ($resp->is_success) { open (DOWNLOAD, "> $Filename") || warn; binmode(DOWNLOAD); print DOWNLOAD $resp->content; close (DOWNLOAD) || warn; return "Success"; } else { return "Fail"; }
I thought the accual downloading was taking place when "print DOWNLOAD $resp->content;" get's fired off. Does this new code help you understand what I'm attempting to do? Alucard

Replies are listed 'Best First'.
Re: Re: Re: Current download information..
by Fastolfe (Vicar) on Jan 05, 2001 at 01:58 UTC
    Sounds like you got Dominus's advice, and that's the way to go. The download actually happens at this line here:
    $resp = $ua->request($req);
    When you get your $resp object back, the request has already been made and a response (hence 'resp') has been retrieved from the server in its entirety. The content method is just accessing that content retrieved in this step.