andreiashu has asked for the wisdom of the Perl Monks concerning the following question:
Do you have any ideea how can i do this ? Or maybe other better solutions ?my $mech = new WWW::Mechanize( max_redirect => 20, autocheck => 1, onerror => \&onFetchError, onwarn => \&onFetchWarn ); # i cannot use max_size because i get a 403 # $mech->max_size("10240"); # so here is what i came up with: $mech->get($myUrl,":content_cb"=> \&myCallback); sub myCallback{ my ($data, $response, $protocol) = @_; my $totalData .= $data; if( (length($totalData ) / 1024) > 10 ){ #I want to stop the transfer now #but it's not working this way... $mech = undef; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Partial http file download
by rhesa (Vicar) on Feb 25, 2008 at 11:00 UTC | |
by andreiashu (Initiate) on Feb 26, 2008 at 09:27 UTC | |
|
Re: Partial http file download
by Anonymous Monk on Feb 25, 2008 at 13:47 UTC |