use Parallel::ForkManager qw( ); use constant MAX_CHILDREN => 3; { my $mech = WWW::Mechanize->new(timeout => 90); my @urllist = ...; my $pm = Parallel::ForkManager->new(MAX_CHILDREN); foreach my $url (@urllist) { # Forks and returns the pid for the child. my $pid = $pm->start() and next; $mech->get($url); print $mech->content()->as_HTML(); # Exit child. $pm->finish(); } }
In reply to Re: Fork and WWW::Mechanize: Can agent be shared?
by ikegami
in thread Fork and WWW::Mechanize: Can agent be shared?
by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |