Hi all,
I am trying to get response from three diff sites and to process the catenate response for some work i am doing
i really don't know what i am doing wrong Please help me
for some reason although for (1..3) the fork creating 5-6 processes and the script doe's not ends
WHAT DO I DO WRONG?
use LWP::UserAgent; my $pid = fork(); my $resp; for (1..3) { if ($pid = fork()) { next; } if (defined $pid) { $resp .= GET(); print "=" x155 ."\n$resp\n" ."=" x155 ."\n"; exit; } else { die "Fork failed\n"; } } sub GET { my $ua = LWP::UserAgent->new; $ua->agent("Perl 5.8.8"); my $req = HTTP::Request->new("GET", "http://www.google.com/"); my $res = $ua->request($req); if ($res->is_success) { print "OK\n"; return $res->content; } else { die "HTTP::Request error"; } }
PS: You can suggest to use ParallelUA, but it's not possible in my case.
In reply to parallel HTTP::Request by RedGrinGo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |