Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Automatic stack traces for warns and dies

by etcshadow (Priest)
on Jul 30, 2004 at 23:22 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://378835]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-24 12:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found