[Israel.pm] Backtrace

Yuval Kogman nothingmuch at woobling.org
Sun Jun 6 06:06:12 PDT 2010


On 6 June 2010 15:53, Peter Gordon <peter at pg-consultants.com> wrote:

> I have a trivial program shown below. In order to better debug an
> application I would like to be able to obtain a stack trace.


To get a formatted one, a la Carp::confess, as a string:

    my $stacktrace = Carp::longmess();

To make Carp::croak behave like Carp::confess:

    perl -MCarp=verbose ...

To make every $SIG{__DIE__} become a Carp::confess:

    perl -MCarp::Always ...

Finally, to get an more useful stacktrace (that you can both format and
inspect programatically), look at Devel::StackTrace.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20100606/6eadf80d/attachment.htm 


More information about the Perl mailing list