Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Capturing stack trace in eval

by moritz (Cardinal)
on Oct 07, 2009 at 20:00 UTC ( [id://799801]=note: print w/replies, xml ) Need Help??


in reply to Re: Capturing stack trace in eval
in thread Capturing stack trace in eval

edit: don't try to use the $SIG{__DIE__} for this. It won't work.

Care to elaborate? Surely it won't work if somebody else fiddles with $SIG{__DIE__}, just like overriding CORE::GLOBAL::die won't work if somebody else fiddles with it at same time.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^3: Capturing stack trace in eval
by Joost (Canon) on Oct 07, 2009 at 20:22 UTC
    Can't get into the details right now, the code I've worked on isn't here. One issue is that $SIG{__DIE__} won't work correctly with eval {} and eval "", even when testing $^S.

    perlvar sais:

    Due to an implementation glitch, the $SIG{__DIE__} hook is called even inside an eval(). Do not use this to rewrite a pending exception in $@, or as a bizarre substitute for overriding CORE::GLOBAL::die(). This strange action at a dis‐ tance may be fixed in a future release so that $SIG{__DIE__} is only called if your program is about to exit, as was the original intent. Any other use is deprecated.
    The only thing overriding CORE::GLOBAL::die won't catch is compile-time parser errors, but then you won't need a stack trace.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-23 21:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found