in reply to Re^2: LWP - content_cb
in thread LWP - content_cb
This doesn't work because (if anything) $data becomes a file handle, but nothing is printed to it.
The idea would be to open a file handle outside of the callback routine, e.g.
open my $fh, ">", "downloaded.pdf" or die $!; binmode $fh; # for when you're on a system (like Windows) where line +feeds are translated
and then within the callback routine, successively print the data to it
sub callback { my ($data, $response, $protocol) = @_; print $fh $data; ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: LWP - content_cb
by papaismurf (Novice) on Feb 15, 2012 at 05:02 UTC | |
by zentara (Cardinal) on Feb 15, 2012 at 09:38 UTC | |
by papaismurf (Novice) on Feb 15, 2012 at 18:06 UTC | |
by Anonymous Monk on Feb 16, 2012 at 01:36 UTC |