NAME

Test2::Context::Trace - Debug information for events

EXPERIMENTAL RELEASE

This is an experimental release. Using this right now is not recommended.

DESCRIPTION

All events need to have access to information about where they were created, as well as if they are todo, or part of a skipped test. This object represents that information.

SYNOPSIS

use Test2::Context::Trace;

my $trace = Test2::Context::Trace->new(
    frame => [$package, $file, $line, $subname],
);

METHODS

$trace->set_detail($msg)
$msg = $trace->detail

Used to get/set a custom trace message that will be used INSTEAD of at <FILE> line <LINE> when calling $trace->debug.

$str = $trace->debug

Typically returns the string at <FILE> line <LINE>. If detail is set then its value wil be returned instead.

$trace->alert($MESSAGE)

This issues a warning at the frame (filename and line number where errors should be reported).

$trace->throw($MESSAGE)

This throws an exception at the frame (filename and line number where errors should be reported).

$frame = $trace->frame()

Get the call frame arrayref.

($package, $file, $line, $subname) = $trace->call()

Get the caller details for the debug-info. This is where errors should be reported.

$pkg = $trace->package

Get the debug-info package.

$file = $trace->file

Get the debug-info filename.

$line = $trace->line

Get the debug-info line number.

$subname = $trace->subname

Get the debug-info subroutine name.

SOURCE

The source code repository for Test2 can be found at http://github.com/Test-More/Test2/.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright 2015 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/