The file routine

Combined from primary sources listed below.

In class CallFrame ( Type/CallFrame )§

See primary docmentation in context for method file.

method file§

method file()

This is a shortcut for looking up the file annotation. Therefore, the following code prints True.

my $frame = callframe(0);
say $frame.file eq $frame.annotations<file>;

In class Backtrace::Frame ( Type/Backtrace/Frame )§

See primary docmentation in context for method file.

method file§

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

Returns the file name.

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

In class Code ( Type/Code )§

See primary docmentation in context for method file.

method file§

method file(Code:D: --> Str:D)

Returns the name of the file in which the code object was declared.

say &infix:<+>.file;   # OUTPUT: «SETTING::src/core.c/Numeric.rakumod␤»

In class Label ( Type/Label )§

See primary docmentation in context for method file.

method file§

Returns the file the label is defined in.