NAME
TB2::AssertRecord - Record an assert happening
SYNOPSIS
use TB2::AssertRecord;
my $record = TB2::AssertRecord->new;
my $record = TB2::AssertRecord->new_from_caller($level);
# All the stuff from caller
my $package = $record->package;
my $filename = $record->filename;
my $line = $record->line;
DESCRIPTION
Records where an assert was called.
Useful for diagnostics and stack traces.
Constructors
new
my $record = TB2::AssertRecord->new({
package => $package,
line => $line,
filename => $filename,
subroutine => $subroutine
});
The normal Mouse constructor. You must supply all the caller information manually.
You should use new_from_caller
.
new_from_caller
my $record = TB2::AssertRecord->new_from_caller($level);
Constructs an AssertRecord for you by calling caller() at the given $level above your call in the call stack.
new_from_guess
my $record = TB2::AssertRecord->new_from_guess;
my $record = TB2::AssertRecord->new_from_guess(@ignore_packages);
Constructs an AssertRecord for you by looking up the call stack until it is out of the calling class.
If @ignore_packages is given, those are also to be ignored when looking up the stack.
Accessors
These are all read-only and act in the expected manner.
filename
The filename from which the asset was called.
line
The line where the assert was called.
package
The class or package in which the assert was called.
subroutine
The fully qualified name of the assert being called.