in reply to "next" in Parallel::ForkManager, and subroutines

Next, use $pm->start to do the fork.   $pm returns 0 for to the child process, and child pid for to the parent process.

“Short circuit” expression evaluation means that the next statement will only be executed if the first half was True, i.e. not-zero, i.e. we are the parent process.

  • Comment on Re: "next" in Parallel::ForkManager, and subroutines

Replies are listed 'Best First'.
Re^2: "next" in Parallel::ForkManager, and subroutines
by locked_user sundialsvc4 (Abbot) on Apr 04, 2012 at 22:03 UTC

    I think the point here is:   next does exactly what it always does.   What’s peculiar at first glance is the use of “short circuit” expression evaluation as a substitute for clarity.

    You see the same sort of thing in statements like:   do_something() or die(“horribly”);   What sounds like a not-so veiled threat, is actually just short-circuit again.   If do_something() returns true, the die() part will not be executed.

    Call me a luddite or simply a non-golfer, but I never write it that way.   I don’t mind using two statements where one statement will do, if by doing so I will eliminate the need for threads like these.   To me, perfect clarity always trumps brevity, and there is no place in the world of engineering for religion (or golf).