Backtrace::Frame Reference
Single frame of a Backtrace
What it is #
Routines #
Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.
method file #
method file(Backtrace::Frame:D --> Str)
Returns Str.
Returns the file name.
method line #
method line(Backtrace::Frame:D --> Int)
Returns Int.
Returns the line number (line numbers start counting from 1).
method code #
method code(Backtrace::Frame:D)
Returns the code object into which .file and .line point, if available.
method subname #
method subname(Backtrace::Frame:D --> Str)
Returns Str.
Returns the name of the enclosing subroutine.
method is-hidden #
method is-hidden(Backtrace::Frame:D: --> Bool:D)
Returns Bool:D.
Returns True if the frame is marked as hidden with the is hidden-from-backtrace trait.
method is-routine #
method is-routine(Backtrace::Frame:D: --> Bool:D)
Returns Bool:D.
Return True if the frame points into a routine (and not into a mere Block).
method is-setting #
method is-setting(Backtrace::Frame:D: --> Bool:D)
Returns Bool:D.
Returns True if the frame is part of a setting.
Examples, run three ways #
Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.
7 no-output · 1 rakupp-differs
class Backtrace::Frame { }Not executed: the documentation states no expected output for this example.
my $bt = Backtrace.new; my $btf = $bt[0]; say $btf.file;
Not executed: the documentation states no expected output for this example.
my $bt = Backtrace.new; my $btf = $bt[0]; say $btf.line;
Not executed: the documentation states no expected output for this example.
my $bt = Backtrace.new; my $btf = $bt[0]; say $btf.code;
Not executed: the documentation states no expected output for this example.
my $bt = Backtrace.new; my $btf = $bt[0]; say $btf.subname;
Not executed: the documentation states no expected output for this example.
my $bt = Backtrace.new; my $btf = $bt[0]; say $btf.is-hidden;
Not executed: the documentation states no expected output for this example.
my $bt = Backtrace.new; my $btf = $bt[0]; say $btf.is-routine;
Not executed: the documentation states no expected output for this example.
my $bt = Backtrace.new; my $btf = $bt[0]; say $btf.is-setting; # OUTPUT: «True»
True
True
Raku++ disagrees with both the documentation and Rakudo — a defect.