yes, I think you can do it using the alternative syntaxes for User::Agent's request.
$request = HTTP::Request->new('GET', 'http://...'); $response = $ua->request($request, '/tmp/sss');
or
$request = HTTP::Request->new('GET', 'http://...'); $response = $ua->request($request, \&callback); sub callback { my ($data, $response, $protocol) = @_; ... }
Update: Working code:
use strict; use warnings; use LWP (); sub callback { my ($data, $response, $protocol) = @_; unless ($response->{'callback_first'}) { $response->{'callback_first'} = 1; my $content_type = join('; ', $response->content_type()); print("Content-Type: $content_type\n"); print("\n"); } # print("\n########################################\n"); print($data); } my $ua = LWP::UserAgent->new(); my $request = HTTP::Request->new('GET', 'http://www.perlmonks.org/'); my $response = $ua->request($request, \&callback);
In reply to Re: how to pipe url back to stdout as stream
by ikegami
in thread how to pipe url back to stdout as stream
by redss
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |