Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by cavac (Curate)
on Oct 21, 2019 at 15:00 UTC ( #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
Node Status?
node history
Node Type: note [id://11107766]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-01-25 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?