Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Automatic stack traces for warns and dies

by etcshadow (Priest)
on Jul 30, 2004 at 23:22 UTC ( #378835=note: print w/replies, xml ) Need Help??


in reply to Automatic stack traces for warns and dies

use Carp qw(confess cluck); $SIG{__WARN__} = 'cluck'; $SIG{__DIE__} = 'confess';
------------ :Wq Not an editor command: Wq

Replies are listed 'Best First'.
Re^2: Automatic stack traces for warns and dies
by fergal (Chaplain) on Jul 30, 2004 at 23:44 UTC
    That is a simpler implementation but it doesn't preserve the original values in %SIG and will also mess up anything that uses real exceptions (as in Error or Exception::Class) which might do something like
    eval { something_that_might_die()}; if ($@->isa('FileException')) { handle_file_exception } else { die $@; }
Re^2: Automatic stack traces for warns and dies
by tachyon (Chancellor) on Jul 31, 2004 at 13:21 UTC

    I love the name of that Carp function confess is just so.....on the money.

    cheers

    tachyon

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2020-11-24 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?