Skip to content

Commit 7f104fe

Browse files
author
Dan Zwell
committed
Describe the Backtrace class in the debugging section.
1 parent c65e01f commit 7f104fe

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/Programs/01-debugging.pod6

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,20 @@ name of the current subroutine / method to the standard error stream:
7171
7272
This can be handy as a cheap trace function.
7373
74+
=head2 The C<Backtrace> class
75+
76+
The C<Backtrace> class gets the current call stack, and can return it as a
77+
string:
78+
79+
my $trace = Backtrace.new;
80+
sub inner { say ~Backtrace.new; }
81+
sub outer { inner; }
82+
outer;
83+
84+
# OUTPUT:
85+
# perl6 /tmp/script.p6
86+
# in sub inner at /tmp/script.p6 line 2
87+
# in sub outer at /tmp/script.p6 line 3
88+
# in block <unit> at /tmp/script.p6 line 4
89+
7490
=end pod

0 commit comments

Comments
 (0)