incognito129 has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: traceback on error (confess)
by tye (Sage) on Feb 22, 2010 at 03:43 UTC

    As I mentioned in the CB when you asked there, use Carp:

    $SIG{__DIE__}= sub { require Carp; Carp::confess(@_); };

    - tye        

Re: traceback on error
by zwon (Abbot) on Feb 22, 2010 at 04:24 UTC

    Also, you can use Carp::Always. Start your script like this:

    perl -MCarp::Always script.pl
    and it will print backtrace if program die.