Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Do the Monks recommend Try::Tiny for eval work? (or do)

by tye (Sage)
on Oct 30, 2015 at 02:51 UTC ( [id://1146439]=note: print w/replies, xml ) Need Help??


in reply to Re: Do the Monks recommend Try::Tiny for eval work?
in thread Do the Monks recommend Try::Tiny for eval work?

Devel::EvalError isn't really needed with a modern version of Perl (where a DESTROY can't clobber $@).

At work I mostly inherited the following pattern:

eval { ... 1 } or do { my $e = $@ || 'Unknown error'; ... };

And I've been pretty happy with it.

We are still on a Perl version where $@ can be clobbered by a DESTROY, but we just exhaustively fix any DESTROY methods.

If you have less control over your code base(s) and have to deal with less modern versions of Perl, then Devel::EvalError might be very useful (it was very useful to me at a prior job).

- tye        

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-24 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found