Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use HTTP::Request::Common; use HTML::Parser; use HTML::TreeBuilder; use LWP::UserAgent; use URI::URL; @longurl = ['http://1.htm', 'http://2.htm', 'http://3.htm' ]; @longfie = ['PostData1', 'PostData2', 'PostData3' ]; $sitetotal=2; my $pid = fork; for ($sitenum=0; $sitenum <= $sitetotal; $sitenum++) { if ($pid = fork) { next; } if (defined $pid) { $ua[$sitenum] = new LWP::UserAgent; $ua[$sitenum]->timeout(4); $res[$sitenum] = $ua[$sitenum]->request(POST $longurl[$sitenum], C +ontent => [ DataField => "$longfie[$sitenum]" ] ); if ($res[$sitenum]->is_success) { $p[$sitenum]->parse($res[$sitenum]->content); } $base = $res[$sitenum]->base; $siten = $longsite[$sitenum]; $p[$sitenum]->traverse(\&extract_alinks, 1); exit; } else { die "Fork failed at number $sitenum: $!\n"; } } $returnstring; sub extract_alinks1 { #extract links and add to $returnstring }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl fork and http::request
by Corion (Patriarch) on Feb 02, 2001 at 01:37 UTC | |
by Anonymous Monk on Feb 02, 2001 at 04:05 UTC | |
|
Re: Perl fork and http::request
by BlueLines (Hermit) on Feb 02, 2001 at 01:37 UTC | |
|
Re: Perl fork and http::request
by Fastolfe (Vicar) on Feb 02, 2001 at 01:50 UTC | |
by Anonymous Monk on Feb 02, 2001 at 02:18 UTC | |
by Fastolfe (Vicar) on Feb 02, 2001 at 02:29 UTC | |
by Anonymous Monk on Feb 02, 2001 at 03:05 UTC |