Documentation for method file

Documentation for method file, assembled from the following types:

class Backtrace::Frame

From Backtrace::Frame

(Backtrace::Frame) method file

Defined as:

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

Returns the file name.

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

class Code

From Code

(Code) method file

Defined as:

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

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

say &infix:<+>.file;

class CallFrame

From CallFrame

(CallFrame) method file

method file(CallFrame:D:)

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>;