Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a traceback in Perl? [duplicate]

Possible Duplicate:
How do I force a stack backtrace for all fatal errors in Perl?

One of the things I like about Python, is that when a script exits because of an error, it spits out a traceback. I'm wondering is there anyway of getting a Perl to do this as well?

like image 941
Incognito Avatar asked Feb 22 '10 02:02

Incognito


1 Answers

Add this to the top of your script:

use Carp 'verbose';
$SIG{ __DIE__ } = sub { Carp::confess( @_ ) };

It will create a stack trace on all fatal errors.

like image 198
Gavin Brock Avatar answered Nov 08 '22 20:11

Gavin Brock