开发者

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

开发者 https://www.devze.com 2022-12-21 07:03 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: How do I force a stack backtrace for all fatal errors in Perl?
This question already has answers here: Closed 12 years ago.

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?


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.


Investigate the Carp::Always module.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号