Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Strange (for me) behavior of Parallel::ForkManager

by mbethke (Hermit)
on Oct 10, 2012 at 01:54 UTC ( #998112=note: print w/ replies, xml ) Need Help??


in reply to Strange (for me) behavior of Parallel::ForkManager

That's expected behavior---finish() is not supposed to return. But why would you want to pass in a code reference as a return code? None of the example code I've looked at does that.

In any case I what you need to do is call finish() within the loop:

while (<LIST>){ $manager->start and next; my @array = split( /\s+/, $_ ); # do child stuff $manager->finish; }


Comment on Re: Strange (for me) behavior of Parallel::ForkManager
Select or Download Code
Re^2: Strange (for me) behavior of Parallel::ForkManager
by Sterh (Novice) on Nov 06, 2012 at 19:28 UTC
    It works , but how to make it go out of the loop?
      If you need to leave early, you can use "last". Otherwise it will just read to EOF and then quit.
        It does not quit loop after executing last iteration. This is the problem, need it to quit after last iteration but it does not. ...
      There's only one process that loops. It loops until it reaches the end of the file, at which point it continues after the loop.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998112]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-10-31 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (225 votes), past polls