Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: "next" in Parallel::ForkManager, and subroutines

by thargas (Deacon)
on Apr 04, 2012 at 18:56 UTC ( #963509=note: print w/ replies, xml ) Need Help??


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

Hmm. The docs for next include:

"next" cannot be used to exit a block which returns a value such as "eval {}", "sub {}" or "do {}", and should not be used to exit a grep() or map() operation.

Doesn't sound supported to me.


Comment on Re^2: "next" in Parallel::ForkManager, and subroutines
Select or Download Code
Replies are listed 'Best First'.
Re^3: "next" in Parallel::ForkManager, and subroutines
by tobyink (Abbot) on Apr 23, 2012 at 10:07 UTC

    I think this is referring to the fact that you can't use next to "just" jump out of a sub (or do or eval) - it needs to jump out of another block (which does not return a value) at a higher level. Compare this:

    sub foo () { next } foo

    with this:

    sub foo () { next } foo for 1

    The first dies with Can't "next" outside a loop block; the second runs successfully, but will warn when warnings are enabled.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-07-30 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls