Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by cavac (Parson)
on Oct 21, 2019 at 15:00 UTC ( [id://11107766]=note: print w/replies, xml ) Need Help??


in reply to eval: Why use the 'Zombie error' idiom?

In the few cases i am forced to use eval, i usually do something like this:

my $ok = 0; eval { do_something_that_might_die(); $ok = 1; }; if(!$ok) { shout_at_user(); }

This way, i don't have to deal with the error message. And in my personal opinion, it's much more readable. The downside, of course, is that Perl::Critic shouts at you - a lot.

perl -e 'use MIME::Base64; print decode_base64("4pmsIE5ldmVyIGdvbm5hIGdpdmUgeW91IHVwCiAgTmV2ZXIgZ29ubmEgbGV0IHlvdSBkb3duLi4uIOKZqwo=");'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-23 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found