1Test2::Event::V2(3) User Contributed Perl Documentation Test2::Event::V2(3)
2
3
4
6 Test2::Event::V2 - Second generation event.
7
9 This is the event type that should be used instead of Test2::Event or
10 its legacy subclasses.
11
13 USING A CONTEXT
14 use Test2::API qw/context/;
15
16 sub my_tool {
17 my $ctx = context();
18
19 my $event = $ctx->send_ev2(info => [{tag => 'NOTE', details => "This is a note"}]);
20
21 $ctx->release;
22
23 return $event;
24 }
25
26 USING THE CONSTRUCTOR
27 use Test2::Event::V2;
28
29 my $e = Test2::Event::V2->new(
30 trace => {frame => [$PKG, $FILE, $LINE, $SUBNAME]},
31 info => [{tag => 'NOTE', details => "This is a note"}],
32 );
33
35 This class inherits from Test2::Event.
36
37 $fd = $e->facet_data()
38 This will return a hashref of facet data. Each facet hash will be a
39 shallow copy of the original.
40
41 $about = $e->about()
42 This will return the 'about' facet hashref.
43
44 NOTE: This will return the internal hashref, not a copy.
45
46 $trace = $e->trace()
47 This will return the 'trace' facet, normally blessed (but this is
48 not enforced when the trace is set using "set_trace()".
49
50 NOTE: This will return the internal trace, not a copy.
51
52 MUTATION
53 $e->add_amnesty({...})
54 Inherited from Test2::Event. This can be used to add 'amnesty'
55 facets to an existing event. Each new item is added to the END of
56 the list.
57
58 NOTE: Items ARE blessed when added.
59
60 $e->add_hub({...})
61 Inherited from Test2::Event. This is used by hubs to stamp events
62 as they pass through. New items are added to the START of the list.
63
64 NOTE: Items ARE NOT blessed when added.
65
66 $e->set_uuid($UUID)
67 Inherited from Test2::Event, overridden to also vivify/mutate the
68 'about' facet.
69
70 $e->set_trace($trace)
71 Inherited from Test2::Event which allows you to change the trace.
72
73 Note: This method does not bless/clone the trace for you. Many
74 things will expect the trace to be blessed, so you should probably
75 do that.
76
77 LEGACY SUPPORT METHODS
78 These are all imported from Test2::Util::Facets2Legacy, see that module
79 or Test2::Event for documentation on what they do.
80
81 causes_fail
82 diagnostics
83 global
84 increments_count
85 no_display
86 sets_plan
87 subtest_id
88 summary
89 terminate
90
92 This object consumes Test2::Util::ExternalMeta which provides a
93 consistent way for you to attach meta-data to instances of this class.
94 This is useful for tools, plugins, and other extensions.
95
97 The source code repository for Test2 can be found at
98 http://github.com/Test-More/test-more/.
99
101 Chad Granum <exodist@cpan.org>
102
104 Chad Granum <exodist@cpan.org>
105
107 Copyright 2018 Chad Granum <exodist@cpan.org>.
108
109 This program is free software; you can redistribute it and/or modify it
110 under the same terms as Perl itself.
111
112 See http://dev.perl.org/licenses/
113
114
115
116perl v5.26.3 2018-03-30 Test2::Event::V2(3)