1Test2::EventFacet::TracUes(e3r)Contributed Perl DocumentTaetsito2n::EventFacet::Trace(3)
2
3
4

NAME

6       Test2::EventFacet::Trace - Debug information for events
7

DESCRIPTION

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

SYNOPSIS

14           use Test2::EventFacet::Trace;
15
16           my $trace = Test2::EventFacet::Trace->new(
17               frame => [$package, $file, $line, $subname],
18           );
19

FACET FIELDS

21       $string = $trace->{details}
22       $string = $trace->details()
23           Used as a custom trace message that will be used INSTEAD of "at
24           <FILE> line <LINE>" when calling "$trace->debug".
25
26       $frame = $trace->{frame}
27       $frame = $trace->frame()
28           Get the call frame arrayref.
29
30               [$package, $file, $line, $subname]
31
32       $int = $trace->{pid}
33       $int = $trace->pid()
34           The process ID in which the event was generated.
35
36       $int = $trace->{tid}
37       $int = $trace->tid()
38           The thread ID in which the event was generated.
39
40       $id = $trace->{cid}
41       $id = $trace->cid()
42           The ID of the context that was used to create the event.
43
44       $uuid = $trace->{uuid}
45       $uuid = $trace->uuid()
46           The UUID of the context that was used to create the event. (If uuid
47           tagging was enabled)
48
49       ($pkg, $file, $line, $subname) = $trace->call
50           Get the basic call info as a list.
51
52       @caller = $trace->full_call
53           Get the full caller(N) results.
54
55       $warning_bits = $trace->warning_bits
56           Get index 9 from the full caller info. This is the warnings_bits
57           field.
58
59           The value of this is not portable across perl versions or even
60           processes.  However it can be used in the process that generated it
61           to reproduce the warnings settings in a new scope.
62
63               eval <<EOT;
64               BEGIN { ${^WARNING_BITS} = $trace->warning_bits };
65               ... context's warning settings apply here ...
66               EOT
67
68   DISCOURAGED HUB RELATED FIELDS
69       These fields were not always set properly by tools. These are MOSTLY
70       deprecated by the Test2::EventFacet::Hub facets. These fields are not
71       required, and may only reflect the hub that was current when the event
72       was created, which is not necessarily the same as the hub the event was
73       sent through.
74
75       Some tools did do a good job setting these to the correct hub, but you
76       cannot always rely on that. Use the 'hubs' facet list instead.
77
78       $hid = $trace->{hid}
79       $hid = $trace->hid()
80           The ID of the hub that was current when the event was created.
81
82       $huuid = $trace->{huuid}
83       $huuid = $trace->huuid()
84           The UUID of the hub that was current when the event was created.
85           (If uuid tagging was enabled).
86
87       $int = $trace->{nested}
88       $int = $trace->nested()
89           How deeply nested the event is.
90
91       $bool = $trace->{buffered}
92       $bool = $trace->buffered()
93           True if the event was buffered and not sent to the formatter
94           independent of a parent (This should never be set when nested is 0
95           or "undef").
96

METHODS

98       Note: All facet frames are also methods.
99
100       $trace->set_detail($msg)
101       $msg = $trace->detail
102           Used to get/set a custom trace message that will be used INSTEAD of
103           "at <FILE> line <LINE>" when calling "$trace->debug".
104
105           "detail()" is an alias to the "details" facet field for backwards
106           compatibility.
107
108       $str = $trace->debug
109           Typically returns the string "at <FILE> line <LINE>". If "detail"
110           is set then its value will be returned instead.
111
112       $trace->alert($MESSAGE)
113           This issues a warning at the frame (filename and line number where
114           errors should be reported).
115
116       $trace->throw($MESSAGE)
117           This throws an exception at the frame (filename and line number
118           where errors should be reported).
119
120       ($package, $file, $line, $subname) = $trace->call()
121           Get the caller details for the debug-info. This is where errors
122           should be reported.
123
124       $pkg = $trace->package
125           Get the debug-info package.
126
127       $file = $trace->file
128           Get the debug-info filename.
129
130       $line = $trace->line
131           Get the debug-info line number.
132
133       $subname = $trace->subname
134           Get the debug-info subroutine name.
135
136       $sig = trace->signature
137           Get a signature string that identifies this trace. This is used to
138           check if multiple events are related. The signature includes pid,
139           tid, file, line number, and the cid.
140

SOURCE

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

MAINTAINERS

146       Chad Granum <exodist@cpan.org>
147

AUTHORS

149       Chad Granum <exodist@cpan.org>
150
152       Copyright 2020 Chad Granum <exodist@cpan.org>.
153
154       This program is free software; you can redistribute it and/or modify it
155       under the same terms as Perl itself.
156
157       See http://dev.perl.org/licenses/
158
159
160
161perl v5.32.0                      2020-10-15       Test2::EventFacet::Trace(3)
Impressum