[Israel.pm] Backtrace

Gaal Yahas gaal at forum2.org
Sun Jun 6 06:18:47 PDT 2010

Note also this from perlfunc for "caller":

               Furthermore, when called from within the DB package,
caller returns more detailed
               information: it sets the list variable @DB::args to be
the arguments with which
               the subroutine was invoked.

               Be aware that the optimizer might have optimized call
frames away before "caller"
               had a chance to get the information.  That means that
caller(N) might not return
               information about the call frame you expect it do, for
"N > 1".  In particular,
               @DB::args might have information from the previous time
"caller" was called.

Carp uses this behind the scenes (in Carp::Heavy).

On Sun, Jun 6, 2010 at 4:06 PM, Yuval Kogman <nothingmuch at woobling.org> wrote:
> 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.
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl

Gaal Yahas <gaal at forum2.org>

More information about the Perl mailing list