in reply to Current download information..

What is $resp? It sounds almost like the download is occurring above the code you pasted, and that $resp is an object holding the results (with the full content of that result). Depending upon the level of abstraction this object is providing you, it may not be possible to do what you're trying to do while still using it. In order to get this kind of progress, you'd need to be inserting progress-checking code directly into the read loop, updating progress information after every block received (or less often). Unless whatever module you're using allows you to hook into that, you'll have to break that out into code you write yourself to retrieve the data. To help further we'd need to know what you're using to retrieve the data.

Or are you talking about getting progress information while saving $resp->content into the DOWNLOAD filehandle?

Replies are listed 'Best First'.
Re: Re: Current download information..
by Anonymous Monk on Jan 05, 2001 at 01:52 UTC
    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
      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.