Perfect !
Thanks !
I have readed lwpcook while I was understanding http and https but I didn't
pay attention in the last lines !!
If someone want to use it, the content is not $res->content !!! is the
concatenation(?) of all the $chunk's.
This is not the best way of resolving the frozen window, but It works good.
Thanks again !
-----Mensaje original-----
De: Flame <gu...@us...>
Para: Guillem Cunillera Wefers <vac...@es...>
CC: perlwin32gui <per...@li...>
Fecha: dilluns, 29 / abril / 2002 21:01
Asunto: Re: [perl-win32-gui-users] Is possible to modify LWP module in order
to avoid a frozen window ?
>Sorry if this was already said, but I haven't had time to pay much
>attention lately, and this post caught my interest. I originally wrote
>this for a program I never released. Some of what it does may or may
>not be helpful, just edit it to suit your needs.
>
>ok, heres the simple way to keep your dialog active:
>
>my $total = 0;
>my $expected;
>my $result = "";
>$UA->request(HTTP::Request->new(GET=>'www.whatever.com'),
> sub {
>
> my($chunk,$res) = @_;
>
> #Total amount of data downloaded
> $total += length($chunk);
>
> #Not important unless you are using the below if statement for
>a status or progress bar.
> unless(defined $expected){
> $expected = $res->content_length || 0;
> }
>
> #Add the new data to the old data.
> $result .= $chunk;
>
> #In this program, I had a status bar, and I was reporting the
>progress on it, could also be used with a progress bar... Remove if not
>needed.
> if($expected){
> $win->StatusBar->Text("Rescieving: $total / $expected");
> }else{
> $win->StatusBar->Text("Rescieving: $total / ???");
> }
>
> #This is the key! Keeps the window alive.
> Win32::GUI::DoEvents() >= 0 or exit;
>
> });
>
>I'm afraid I can't go into much detail at the moment to explain it, but
>if you have any questions, feel free to ask.
>
|