in reply to Please Explain the Parallel::ForkManager Idiom my $pid = $pm->start and next;
When $pm->start returns, two processes exist, the parent and the child. In the parent process, $pm->start returns the process id which is a non-zero value (ie true) and thus and executes the next command. In the child process, $pm->start returns 0 (ie false) and thus and short-circuits (if the first argument is false already, and returns false always without evaluating the second argument). This way, next is not executed but the remaining body of the loop.
So, you are correct, next is skipped (in the child) and not skipped (in the parent).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Please Explain the Parallel::ForkManager Idiom my $pid = $pm->start and next;
by Jim (Curate) on Feb 04, 2014 at 08:02 UTC | |
by karlgoethebier (Abbot) on Feb 04, 2014 at 09:17 UTC | |
by Jim (Curate) on Feb 04, 2014 at 17:10 UTC | |
by karlgoethebier (Abbot) on Feb 04, 2014 at 18:24 UTC | |
by Jim (Curate) on Feb 04, 2014 at 19:50 UTC | |
|