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