T M
class Backtrace::Frame
Error ReportCollection examples

Single frame of a Backtrace

class Backtrace::Frame { }

A single backtrace frame. It identifies a location in the source code.

Methods

method file

Defined as:

method file(Backtrace::Frame:D --> Str)

Returns the file name.

my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.file;

method line

Defined as:

method line(Backtrace::Frame:D --> Int)

Returns the line number (line numbers start counting from 1).

my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.line;

method code

Defined as:

method code(Backtrace::Frame:D)

Returns the code object into which .file and .line point, if available.

my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.code;

method subname

Defined as:

method subname(Backtrace::Frame:D --> Str)

Returns the name of the enclosing subroutine.

my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.subname;

method is-hidden

Defined as:

method is-hidden(Backtrace::Frame:D: --> Bool:D)

Returns True if the frame is marked as hidden with the is hidden-from-backtrace trait.

my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.is-hidden;

method is-routine

Defined as:

method is-routine(Backtrace::Frame:D: --> Bool:D)

Return True if the frame points into a routine (and not into a mere Block).

my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.is-routine;

method is-setting

Defined as:

method is-setting(Backtrace::Frame:D: --> Bool:D)

Returns True if the frame is part of a setting.

my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.is-setting# OUTPUT: «True␤»