++ed by:
DOY SARTAK DEMIAN BBYRD TINITA

88 PAUSE users
53 non-PAUSE users.

Chad Granum

NAME

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

DESCRIPTION

The Test2::API::Context object, as well as all Test2::Event types need to have access to information about where they were created. This object represents that information.

SYNOPSIS

    use Test2::Util::Trace;

    my $trace = Test2::Util::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 will 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.

$sig = trace->signature

Get a signature string that identifies this trace. This is used to check if multiple events are related. The Trace includes pid, tid, file, line number, and the cid which is 'C\d+' for traces created by a context, or 'T\d+' for traces created by new().

$hashref = $t->TO_JSON

This returns a hashref suitable for passing to the Test2::Util::Trace->from_json constructor. It is intended for use with the JSON family of modules, which will look for a TO_JSON method when convert_blessed is true.

$t = Test2::Util::Trace->from_json(%$hashref)

Given the hash of data returned by $t->TO_JSON, this method returns a new trace object of the appropriate subclass.

SOURCE

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

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright 2016 Chad Granum <exodist@cpan.org>.

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/