It's not terribly important to this discussion that I mention this, but the and next bit is not part of what's confusing me. I understand this part of the idiom.
However, instead of doing this…
CHILD: foreach my $child ( 0 .. $#names ) { my $pid = $pm->start($names[$child]) and next; # Child process... }
…I would typically prefer to do this…
CHILD: for my $child ( 0 .. $#names ) { my $pid = $pm->start($names[$child]); next CHILD if $pid != 0; # Parent process # Child process... }
I think this is more in line with PBP, but I could be mistaken.
Jim
In reply to Re^2: Please Explain the Parallel::ForkManager Idiom my $pid = $pm->start and next;
by Jim
in thread Please Explain the Parallel::ForkManager Idiom my $pid = $pm->start and next;
by Jim
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |