Debian Codegraph @

upstream/debian-unstable/man3/Test2::Event::V2.3perl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "Test2::Event::V2 3perl"
58 .TH Test2::Event::V2 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 Test2::Event::V2 \- Second generation event.
65 .SH DESCRIPTION
66 .IX Header "DESCRIPTION"
67 This is the event type that should be used instead of Test2::Event or its
68 legacy subclasses.
69 .SH SYNOPSIS
70 .IX Header "SYNOPSIS"
71 .SS "USING A CONTEXT"
72 .IX Subsection "USING A CONTEXT"
73 .Vb 1
74 \& use Test2::API qw/context/;
75 \&
76 \& sub my_tool {
77 \& my $ctx = context();
78 \&
79 \& my $event = $ctx\->send_ev2(info => [{tag => \*(AqNOTE\*(Aq, details => "This is a note"}]);
80 \&
81 \& $ctx\->release;
82 \&
83 \& return $event;
84 \& }
85 .Ve
86 .SS "USING THE CONSTRUCTOR"
87 .IX Subsection "USING THE CONSTRUCTOR"
88 .Vb 1
89 \& use Test2::Event::V2;
90 \&
91 \& my $e = Test2::Event::V2\->new(
92 \& trace => {frame => [$PKG, $FILE, $LINE, $SUBNAME]},
93 \& info => [{tag => \*(AqNOTE\*(Aq, details => "This is a note"}],
94 \& );
95 .Ve
96 .SH METHODS
97 .IX Header "METHODS"
98 This class inherits from Test2::Event.
99 .ie n .IP "$fd = $e\->\fBfacet_data()\fR" 4
100 .el .IP "\f(CW$fd\fR = \f(CW$e\fR\->\fBfacet_data()\fR" 4
101 .IX Item "$fd = $e->facet_data()"
102 This will return a hashref of facet data. Each facet hash will be a shallow
103 copy of the original.
104 .ie n .IP "$about = $e\->\fBabout()\fR" 4
105 .el .IP "\f(CW$about\fR = \f(CW$e\fR\->\fBabout()\fR" 4
106 .IX Item "$about = $e->about()"
107 This will return the 'about' facet hashref.
108 .Sp
109 \&\fBNOTE:\fR This will return the internal hashref, not a copy.
110 .ie n .IP "$trace = $e\->\fBtrace()\fR" 4
111 .el .IP "\f(CW$trace\fR = \f(CW$e\fR\->\fBtrace()\fR" 4
112 .IX Item "$trace = $e->trace()"
113 This will return the 'trace' facet, normally blessed (but this is not enforced
114 when the trace is set using \f(CWset_trace()\fR.
115 .Sp
116 \&\fBNOTE:\fR This will return the internal trace, not a copy.
117 .SS MUTATION
118 .IX Subsection "MUTATION"
119 .ie n .IP $e\->add_amnesty({...}) 4
120 .el .IP \f(CW$e\fR\->add_amnesty({...}) 4
121 .IX Item "$e->add_amnesty({...})"
122 Inherited from Test2::Event. This can be used to add 'amnesty' facets to an
123 existing event. Each new item is added to the \fBEND\fR of the list.
124 .Sp
125 \&\fBNOTE:\fR Items \fBARE\fR blessed when added.
126 .ie n .IP $e\->add_hub({...}) 4
127 .el .IP \f(CW$e\fR\->add_hub({...}) 4
128 .IX Item "$e->add_hub({...})"
129 Inherited from Test2::Event. This is used by hubs to stamp events as they
130 pass through. New items are added to the \fBSTART\fR of the list.
131 .Sp
132 \&\fBNOTE:\fR Items \fBARE NOT\fR blessed when added.
133 .ie n .IP $e\->set_uuid($UUID) 4
134 .el .IP \f(CW$e\fR\->set_uuid($UUID) 4
135 .IX Item "$e->set_uuid($UUID)"
136 Inherited from Test2::Event, overridden to also vivify/mutate the 'about'
137 facet.
138 .ie n .IP $e\->set_trace($trace) 4
139 .el .IP \f(CW$e\fR\->set_trace($trace) 4
140 .IX Item "$e->set_trace($trace)"
141 Inherited from Test2::Event which allows you to change the trace.
142 .Sp
143 \&\fBNote:\fR This method does not bless/clone the trace for you. Many things will
144 expect the trace to be blessed, so you should probably do that.
145 .SS "LEGACY SUPPORT METHODS"
146 .IX Subsection "LEGACY SUPPORT METHODS"
147 These are all imported from Test2::Util::Facets2Legacy, see that module or
148 Test2::Event for documentation on what they do.
149 .IP causes_fail 4
150 .IX Item "causes_fail"
151 .PD 0
152 .IP diagnostics 4
153 .IX Item "diagnostics"
154 .IP global 4
155 .IX Item "global"
156 .IP increments_count 4
157 .IX Item "increments_count"
158 .IP no_display 4
159 .IX Item "no_display"
160 .IP sets_plan 4
161 .IX Item "sets_plan"
162 .IP subtest_id 4
163 .IX Item "subtest_id"
164 .IP summary 4
165 .IX Item "summary"
166 .IP terminate 4
167 .IX Item "terminate"
168 .PD
169 .SH "THIRD PARTY META-DATA"
170 .IX Header "THIRD PARTY META-DATA"
171 This object consumes Test2::Util::ExternalMeta which provides a consistent
172 way for you to attach meta-data to instances of this class. This is useful for
173 tools, plugins, and other extensions.
174 .SH SOURCE
175 .IX Header "SOURCE"
176 The source code repository for Test2 can be found at
177 <https://github.com/Test\-More/test\-more/>.
178 .SH MAINTAINERS
179 .IX Header "MAINTAINERS"
180 .IP "Chad Granum <[email protected]>" 4
181 .IX Item "Chad Granum <[email protected]>"
182 .SH AUTHORS
183 .IX Header "AUTHORS"
184 .PD 0
185 .IP "Chad Granum <[email protected]>" 4
186 .IX Item "Chad Granum <[email protected]>"
187 .PD
188 .SH COPYRIGHT
189 .IX Header "COPYRIGHT"
190 Copyright 2020 Chad Granum <[email protected]>.
191 .PP
192 This program is free software; you can redistribute it and/or
193 modify it under the same terms as Perl itself.
194 .PP
195 See <https://dev.perl.org/licenses/>