Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

traceback on error

by incognito129 (Acolyte)
on Feb 22, 2010 at 02:19 UTC ( #824563=perlquestion: print w/replies, xml ) Need Help??

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
    and it will print backtrace if program die.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://824563]
Approved by ww
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2021-11-29 09:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found