in reply to LWP::Simple - so they say!
In that case, I'd call plain "GET" but you could abort halfway. You then will have to use a callback. See getprint (in LWP::Simple) as an example, which I have reproduced here:
You'd have to reproduce this but of course with a different callback... With die and eval BLOCK, it might just work.sub getprint ($) { my($url) = @_; my $request = HTTP::Request->new(GET => $url); local($\) = ""; # ensure standard $OUTPUT_RECORD_SEPARATOR my $callback = sub { print $_[0] }; if ($^O eq "MacOS") { $callback = sub { $_[0] =~ s/\015?\012/\n/g; print $_[0] } } my $response = $ua->request($request, $callback); unless ($response->is_success) { print STDERR $response->status_line, " <URL:$url>\n"; } $response->code; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: LWP::Simple - so they say!
by Anonymous Monk on Apr 20, 2012 at 11:52 UTC |