Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: (tye)Re: Checking the success of eval

by ncw (Friar)
on Apr 21, 2001 at 02:31 UTC ( #74356=note: print w/replies, xml ) Need Help??


in reply to (tye)Re: Checking the success of eval
in thread Checking the success of eval

Thank you for that $^S nugget tye - I shall faithfully inscribe this into all my $SIG{__DIE__} handlers :-)

I agree with you that eval is essential, but I disagree with you that $SIG{__DIE__} is a completely bad idea. Just think of if like an eval { } or do_stuff round your entire code and you could come to love it ;-) (If it actually worked that way of course!)

I like $SIG{__DIE__} for CGI's in the form of CGI::Carp which is really very useful - it would be tiresome to be doing that with eval. I also like $SIG{__DIE__} so I can write scripts which mail me when they've blown up!

I don't see how you would do it with an END block - perhaps you could enlighten me there? How do you know in an END block whether your program is dieing or just exiting and if you can tell how do you get the value of $@ (presuming that some other destructor/END block used eval)?

  • Comment on Re: (tye)Re: Checking the success of eval

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2020-06-05 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (35 votes). Check out past polls.

    Notices?