Something like this should do the trick:

my $req = new HTTP::Request GET => $url;
my $res = $ua->request($req, sub {Win32::GUI::DoEvents();},
1024);

That will make your request and update the window every 1024
bytes read from the response. That particular snippet obviously
does nothing with the response but you can do quite a bit of
useful things here. This worked really well with the download
application I am trying to make.

The only hang-up is that if your request times out or blocks for
any number of other reasons (DNS failures don't return within the
UserAgent timeout, they can take up to a minute to resolve) the
screen will freeze until you get the error response code.

Check out LWP's documentation for more details there's some
useful variables and methods you can use within the sub if I
remember correctly.

Michael


>
> Do you have a code example how to call LWP with the callback
> function?
>
> Thanks a lot,
> Felix Gaehler


Reply via email to