RedGrinGo has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parallel HTTP::Request
by Anonymous Monk on Jan 12, 2010 at 09:05 UTC | |
by Anonymous Monk on Jan 12, 2010 at 11:18 UTC | |
by RedGrinGo (Novice) on Jan 12, 2010 at 09:20 UTC | |
by RedGrinGo (Novice) on Jan 12, 2010 at 09:39 UTC | |
by Anonymous Monk on Jan 12, 2010 at 10:14 UTC | |
|
Re: parallel HTTP::Request
by happy.barney (Friar) on Jan 12, 2010 at 13:31 UTC | |
|
Re: parallel HTTP::Request
by suaveant (Parson) on Jan 12, 2010 at 14:17 UTC |