In Perl, is there a way to force all fatal errors to display a stack backtrace like Carp::confess produces?
I know you can do use warnings FATAL => 'all'; to make warnings fatal over the current lexical scope.
Further it is possible to use $SIG{__WARN__} = sub { CORE::die(@_) }; to make all warnings fatal everywhere (that hasn't localized the SIGWARN handler).
Is there a clean way to do this, or do I need to tweak SIGDIE? And if I do write a SIGDIE handler, what is the best way to get the trace?
An ideal solution would work with the standard testing libraries, Test::More and friends.
Update: Mark Johnson suggests using a SIGDIE handler to call Carp::confess. It works nicely. Here's the code:
use Carp;
$SIG{ __DIE__ } = sub { Carp::confess( @_ ) };