I'm not at all a parallel monk and here there are, very skilled.
> my $pm= new Parallel::ForkManager(8); #didn’t matter if it’s 1 or 5 or whatever else
your original program crash here too and in the same way, but with 1 does not.
I have borrowed the below modifying it a little from example from P::FM docs and the resulting code runs with no crashes. At least something to start with:
use Parallel::ForkManager; use LWP::Simple; my $pm = Parallel::ForkManager->new(10); LINKS: for my $link ('http://us.a1.yimg.com/us.yimg.com/i/ww/m5v9.gif', 'http://hooboy.no-such-host.int/', 'http://www.yahoo.com', 'http://www.ora.com/ask_tim/graphics/asktim_header_main.gif', 'http://www.guardian.co.uk/', 'http://www.pixunlimited.co.uk/siteheaders/Guardian.gif') { $pm->start and next LINKS; my ($content_type, $document_length, $modified_time, $expires, $ +server) = head($link); print "$link fetched: declared lenght $document_length, \n"; $pm->finish; }; # output http://hooboy.no-such-host.int/ fetched: declared lenght , http://us.a1.yimg.com/us.yimg.com/i/ww/m5v9.gif fetched: declared leng +ht 5611, http://www.guardian.co.uk/ fetched: declared lenght 628397, http://www.ora.com/ask_tim/graphics/asktim_header_main.gif fetched: de +clared lenght , http://www.pixunlimited.co.uk/siteheaders/Guardian.gif fetched: declar +ed lenght , http://www.yahoo.com fetched: declared lenght 12,
L*
In reply to Re: Crash with ForkManager on Windows
by Discipulus
in thread Crash with ForkManager on Windows
by amitsq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |