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

Re^4: eval: Why use the 'Zombie error' idiom?

by kikuchiyo (Hermit)
on Oct 18, 2019 at 11:34 UTC ( [id://11107654]=note: print w/replies, xml ) Need Help??


in reply to Re^3: eval: Why use the 'Zombie error' idiom?
in thread eval: Why use the 'Zombie error' idiom?

The reason I avoid Try::Tiny is that its catch block is actually a function in disguise, not just a block like with the original eval idiom. So a return from a Try::Tiny catch block returns just from that block, and not from the enclosing function, which is useless and misleading.
  • Comment on Re^4: eval: Why use the 'Zombie error' idiom?

Replies are listed 'Best First'.
Re^5: eval: Why use the 'Zombie error' idiom?
by hippo (Bishop) on Oct 18, 2019 at 13:15 UTC

    Indeed so, and the Try::Tiny POD explains this in some detail. If you want to return directly from a catch block then Syntax::Keyword::Try might be for you? There's also TryCatch but that uses Moose so isn't exactly the lightest tool in the box.

Re^5: eval: Why use the 'Zombie error' idiom?
by jcb (Parson) on Oct 18, 2019 at 23:13 UTC

    Interestingly, the block names used with the loop control operators are dynamically scoped, so last, next, and redo all work in that context, but I do not think that there is any good way to actually return a value from the sub in such a block.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found