Debian Codegraph @

upstream/mageia-cauldron/man3pm/Test2::Event::Generic.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::Generic 3pm"
61 .TH Test2::Event::Generic 3pm 2025-06-24 "perl v5.42.0" "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::Generic \- Generic event type.
68 .SH DESCRIPTION
69 .IX Header "DESCRIPTION"
70 This is a generic event that lets you customize all fields in the event API.
71 This is useful if you have need for a custom event that does not make sense as
72 a published reusable event subclass.
73 .SH SYNOPSIS
74 .IX Header "SYNOPSIS"
75 .Vb 1
76 \& use Test2::API qw/context/;
77 \&
78 \& sub send_custom_fail {
79 \& my $ctx = shift;
80 \&
81 \& $ctx\->send_event(\*(AqGeneric\*(Aq, causes_fail => 1, summary => \*(AqThe sky is falling\*(Aq);
82 \&
83 \& $ctx\->release;
84 \& }
85 \&
86 \& send_custom_fail();
87 .Ve
88 .SH METHODS
89 .IX Header "METHODS"
90 .ie n .IP $e\->facet_data($data) 4
91 .el .IP \f(CW$e\fR\->facet_data($data) 4
92 .IX Item "$e->facet_data($data)"
93 .PD 0
94 .ie n .IP "$data = $e\->facet_data" 4
95 .el .IP "\f(CW$data\fR = \f(CW$e\fR\->facet_data" 4
96 .IX Item "$data = $e->facet_data"
97 .PD
98 Get or set the facet data (see Test2::Event). If no facet_data is set then
99 \&\f(CW\*(C`Test2::Event\->facet_data\*(C'\fR will be called to produce facets from the other
100 data.
101 .ie n .IP $e\->callback($hub) 4
102 .el .IP \f(CW$e\fR\->callback($hub) 4
103 .IX Item "$e->callback($hub)"
104 Call the custom callback if one is set, otherwise this does nothing.
105 .ie n .IP "$e\->set_callback(sub { ... })" 4
106 .el .IP "\f(CW$e\fR\->set_callback(sub { ... })" 4
107 .IX Item "$e->set_callback(sub { ... })"
108 Set the custom callback. The custom callback must be a coderef. The first
109 argument to your callback will be the event itself, the second will be the
110 Test2::Event::Hub that is using the callback.
111 .ie n .IP "$bool = $e\->causes_fail" 4
112 .el .IP "\f(CW$bool\fR = \f(CW$e\fR\->causes_fail" 4
113 .IX Item "$bool = $e->causes_fail"
114 .PD 0
115 .ie n .IP $e\->set_causes_fail($bool) 4
116 .el .IP \f(CW$e\fR\->set_causes_fail($bool) 4
117 .IX Item "$e->set_causes_fail($bool)"
118 .PD
119 Get/Set the \f(CW\*(C`causes_fail\*(C'\fR attribute. This defaults to \f(CW0\fR.
120 .ie n .IP "$bool = $e\->diagnostics" 4
121 .el .IP "\f(CW$bool\fR = \f(CW$e\fR\->diagnostics" 4
122 .IX Item "$bool = $e->diagnostics"
123 .PD 0
124 .ie n .IP $e\->set_diagnostics($bool) 4
125 .el .IP \f(CW$e\fR\->set_diagnostics($bool) 4
126 .IX Item "$e->set_diagnostics($bool)"
127 .PD
128 Get/Set the \f(CW\*(C`diagnostics\*(C'\fR attribute. This defaults to \f(CW0\fR.
129 .ie n .IP "$bool_or_undef = $e\->global" 4
130 .el .IP "\f(CW$bool_or_undef\fR = \f(CW$e\fR\->global" 4
131 .IX Item "$bool_or_undef = $e->global"
132 .PD 0
133 .ie n .IP "@bool_or_empty = $e\->global" 4
134 .el .IP "\f(CW@bool_or_empty\fR = \f(CW$e\fR\->global" 4
135 .IX Item "@bool_or_empty = $e->global"
136 .ie n .IP $e\->set_global($bool_or_undef) 4
137 .el .IP \f(CW$e\fR\->set_global($bool_or_undef) 4
138 .IX Item "$e->set_global($bool_or_undef)"
139 .PD
140 Get/Set the \f(CW\*(C`diagnostics\*(C'\fR attribute. This defaults to an empty list which is
141 undef in scalar context.
142 .ie n .IP "$bool = $e\->increments_count" 4
143 .el .IP "\f(CW$bool\fR = \f(CW$e\fR\->increments_count" 4
144 .IX Item "$bool = $e->increments_count"
145 .PD 0
146 .ie n .IP $e\->set_increments_count($bool) 4
147 .el .IP \f(CW$e\fR\->set_increments_count($bool) 4
148 .IX Item "$e->set_increments_count($bool)"
149 .PD
150 Get/Set the \f(CW\*(C`increments_count\*(C'\fR attribute. This defaults to \f(CW0\fR.
151 .ie n .IP "$bool = $e\->no_display" 4
152 .el .IP "\f(CW$bool\fR = \f(CW$e\fR\->no_display" 4
153 .IX Item "$bool = $e->no_display"
154 .PD 0
155 .ie n .IP $e\->set_no_display($bool) 4
156 .el .IP \f(CW$e\fR\->set_no_display($bool) 4
157 .IX Item "$e->set_no_display($bool)"
158 .PD
159 Get/Set the \f(CW\*(C`no_display\*(C'\fR attribute. This defaults to \f(CW0\fR.
160 .ie n .IP "@plan = $e\->sets_plan" 4
161 .el .IP "\f(CW@plan\fR = \f(CW$e\fR\->sets_plan" 4
162 .IX Item "@plan = $e->sets_plan"
163 Get the plan if this event sets one. The plan is a list of up to 3 items:
164 \&\f(CW\*(C`($count, $directive, $reason)\*(C'\fR. \f(CW$count\fR must be defined, the others may be
165 undef, or may not exist at all.
166 .ie n .IP $e\->set_sets_plan(\e@plan) 4
167 .el .IP \f(CW$e\fR\->set_sets_plan(\e@plan) 4
168 .IX Item "$e->set_sets_plan(@plan)"
169 Set the plan. You must pass in an arrayref with up to 3 elements.
170 .ie n .IP "$summary = $e\->summary" 4
171 .el .IP "\f(CW$summary\fR = \f(CW$e\fR\->summary" 4
172 .IX Item "$summary = $e->summary"
173 .PD 0
174 .ie n .IP $e\->set_summary($summary_or_undef) 4
175 .el .IP \f(CW$e\fR\->set_summary($summary_or_undef) 4
176 .IX Item "$e->set_summary($summary_or_undef)"
177 .PD
178 Get/Set the summary. This will default to the event package
179 \&\f(CW\*(AqTest2::Event::Generic\*(Aq\fR. You can set it to any value. Setting this to
180 \&\f(CW\*(C`undef\*(C'\fR will reset it to the default.
181 .ie n .IP "$int_or_undef = $e\->terminate" 4
182 .el .IP "\f(CW$int_or_undef\fR = \f(CW$e\fR\->terminate" 4
183 .IX Item "$int_or_undef = $e->terminate"
184 .PD 0
185 .ie n .IP "@int_or_empty = $e\->terminate" 4
186 .el .IP "\f(CW@int_or_empty\fR = \f(CW$e\fR\->terminate" 4
187 .IX Item "@int_or_empty = $e->terminate"
188 .ie n .IP $e\->set_terminate($int_or_undef) 4
189 .el .IP \f(CW$e\fR\->set_terminate($int_or_undef) 4
190 .IX Item "$e->set_terminate($int_or_undef)"
191 .PD
192 This will get/set the \f(CW\*(C`terminate\*(C'\fR attribute. This defaults to undef in scalar
193 context, or an empty list in list context. Setting this to undef will clear it
194 completely. This must be set to a positive integer (0 or larger).
195 .SH SOURCE
196 .IX Header "SOURCE"
197 The source code repository for Test2 can be found at
198 <https://github.com/Test\-More/test\-more/>.
199 .SH MAINTAINERS
200 .IX Header "MAINTAINERS"
201 .IP "Chad Granum <[email protected]>" 4
202 .IX Item "Chad Granum <[email protected]>"
203 .SH AUTHORS
204 .IX Header "AUTHORS"
205 .IP "Chad Granum <[email protected]>" 4
206 .IX Item "Chad Granum <[email protected]>"
207 .SH COPYRIGHT
208 .IX Header "COPYRIGHT"
209 Copyright Chad Granum <[email protected]>.
210 .PP
211 This program is free software; you can redistribute it and/or
212 modify it under the same terms as Perl itself.
213 .PP
214 See <https://dev.perl.org/licenses/>