Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: LWP::Simple Getstore memory

by aitap (Curate)
on Jun 05, 2013 at 06:30 UTC ( [id://1037137]=note: print w/replies, xml ) Need Help??


in reply to LWP::Simple Getstore memory

Looking at LWP::Simple sources, it's already done:
sub getstore ($$) { my($url, $file) = @_; my $request = HTTP::Request->new(GET => $url); my $response = $ua->request($request, $file); $response->code; }
And $file ends up in LWP::Protocol collect() method:
elsif (!ref($arg) && length($arg)) { open(my $fh, ">", $arg) or die "Can't write to '$arg': $!" +; binmode($fh); push(@{$response->{handlers}{response_data}}, { callback => sub { print $fh $_[3] or die "Can't write to '$arg': $!" +; 1; }, });
Files are not loaded into memory. You may want to tweak :read_size_hint argument of get() method of LWP::UserAgent if it still overflows.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1037137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found