http://qs321.pair.com?node_id=378835


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