Debian Codegraph @

upstream/opensuse-tumbleweed/man3/Test2::Event::V2.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (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 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "Test2::Event::V2 3pm"
61 .TH Test2::Event::V2 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 Test2::Event::V2 \- Second generation event.
68 .SH DESCRIPTION
69 .IX Header "DESCRIPTION"
70 This is the event type that should be used instead of Test2::Event or its
71 legacy subclasses.
72 .SH SYNOPSIS
73 .IX Header "SYNOPSIS"
74 .SS "USING A CONTEXT"
75 .IX Subsection "USING A CONTEXT"
76 .Vb 1
77 \& use Test2::API qw/context/;
78 \&
79 \& sub my_tool {
80 \& my $ctx = context();
81 \&
82 \& my $event = $ctx\->send_ev2(info => [{tag => \*(AqNOTE\*(Aq, details => "This is a note"}]);
83 \&
84 \& $ctx\->release;
85 \&
86 \& return $event;
87 \& }
88 .Ve
89 .SS "USING THE CONSTRUCTOR"
90 .IX Subsection "USING THE CONSTRUCTOR"
91 .Vb 1
92 \& use Test2::Event::V2;
93 \&
94 \& my $e = Test2::Event::V2\->new(
95 \& trace => {frame => [$PKG, $FILE, $LINE, $SUBNAME]},
96 \& info => [{tag => \*(AqNOTE\*(Aq, details => "This is a note"}],
97 \& );
98 .Ve
99 .SH METHODS
100 .IX Header "METHODS"
101 This class inherits from Test2::Event.
102 .ie n .IP "$fd = $e\->\fBfacet_data()\fR" 4
103 .el .IP "\f(CW$fd\fR = \f(CW$e\fR\->\fBfacet_data()\fR" 4
104 .IX Item "$fd = $e->facet_data()"
105 This will return a hashref of facet data. Each facet hash will be a shallow
106 copy of the original.
107 .ie n .IP "$about = $e\->\fBabout()\fR" 4
108 .el .IP "\f(CW$about\fR = \f(CW$e\fR\->\fBabout()\fR" 4
109 .IX Item "$about = $e->about()"
110 This will return the \*(Aqabout\*(Aq facet hashref.
111 .Sp
112 \&\fBNOTE:\fR This will return the internal hashref, not a copy.
113 .ie n .IP "$trace = $e\->\fBtrace()\fR" 4
114 .el .IP "\f(CW$trace\fR = \f(CW$e\fR\->\fBtrace()\fR" 4
115 .IX Item "$trace = $e->trace()"
116 This will return the \*(Aqtrace\*(Aq facet, normally blessed (but this is not enforced
117 when the trace is set using \f(CWset_trace()\fR.
118 .Sp
119 \&\fBNOTE:\fR This will return the internal trace, not a copy.
120 .SS MUTATION
121 .IX Subsection "MUTATION"
122 .ie n .IP $e\->add_amnesty({...}) 4
123 .el .IP \f(CW$e\fR\->add_amnesty({...}) 4
124 .IX Item "$e->add_amnesty({...})"
125 Inherited from Test2::Event. This can be used to add \*(Aqamnesty\*(Aq facets to an
126 existing event. Each new item is added to the \fBEND\fR of the list.
127 .Sp
128 \&\fBNOTE:\fR Items \fBARE\fR blessed when added.
129 .ie n .IP $e\->add_hub({...}) 4
130 .el .IP \f(CW$e\fR\->add_hub({...}) 4
131 .IX Item "$e->add_hub({...})"
132 Inherited from Test2::Event. This is used by hubs to stamp events as they
133 pass through. New items are added to the \fBSTART\fR of the list.
134 .Sp
135 \&\fBNOTE:\fR Items \fBARE NOT\fR blessed when added.
136 .ie n .IP $e\->set_uuid($UUID) 4
137 .el .IP \f(CW$e\fR\->set_uuid($UUID) 4
138 .IX Item "$e->set_uuid($UUID)"
139 Inherited from Test2::Event, overridden to also vivify/mutate the \*(Aqabout\*(Aq
140 facet.
141 .ie n .IP $e\->set_trace($trace) 4
142 .el .IP \f(CW$e\fR\->set_trace($trace) 4
143 .IX Item "$e->set_trace($trace)"
144 Inherited from Test2::Event which allows you to change the trace.
145 .Sp
146 \&\fBNote:\fR This method does not bless/clone the trace for you. Many things will
147 expect the trace to be blessed, so you should probably do that.
148 .SS "LEGACY SUPPORT METHODS"
149 .IX Subsection "LEGACY SUPPORT METHODS"
150 These are all imported from Test2::Util::Facets2Legacy, see that module or
151 Test2::Event for documentation on what they do.
152 .IP causes_fail 4
153 .IX Item "causes_fail"
154 .PD 0
155 .IP diagnostics 4
156 .IX Item "diagnostics"
157 .IP global 4
158 .IX Item "global"
159 .IP increments_count 4
160 .IX Item "increments_count"
161 .IP no_display 4
162 .IX Item "no_display"
163 .IP sets_plan 4
164 .IX Item "sets_plan"
165 .IP subtest_id 4
166 .IX Item "subtest_id"
167 .IP summary 4
168 .IX Item "summary"
169 .IP terminate 4
170 .IX Item "terminate"
171 .PD
172 .SH "THIRD PARTY META\-DATA"
173 .IX Header "THIRD PARTY META-DATA"
174 This object consumes Test2::Util::ExternalMeta which provides a consistent
175 way for you to attach meta\-data to instances of this class. This is useful for
176 tools, plugins, and other extensions.
177 .SH SOURCE
178 .IX Header "SOURCE"
179 The source code repository for Test2 can be found at
180 <https://github.com/Test\-More/test\-more/>.
181 .SH MAINTAINERS
182 .IX Header "MAINTAINERS"
183 .IP "Chad Granum <[email protected]>" 4
184 .IX Item "Chad Granum <[email protected]>"
185 .SH AUTHORS
186 .IX Header "AUTHORS"
187 .IP "Chad Granum <[email protected]>" 4
188 .IX Item "Chad Granum <[email protected]>"
189 .SH COPYRIGHT
190 .IX Header "COPYRIGHT"
191 Copyright Chad Granum <[email protected]>.
192 .PP
193 This program is free software; you can redistribute it and/or
194 modify it under the same terms as Perl itself.
195 .PP
196 See <https://dev.perl.org/licenses/>