1Test2::Manual::Tooling:U:sPelrugCionn:tT:reTisobtou2lt:Ce:odMmapPnleueratlle:sD:(oT3co)uomleinntga:t:iPolnugin::ToolCompletes(3)
2
3
4
6 Test2::Manual::Tooling::Plugin::ToolCompletes - How to add behaviors
7 that occur when a tool completes work.
8
10 This tutorial helps you understand how to add behaviors that occur when
11 a tool is done with its work. All tools need to acquire and then
12 release a context, for this tutorial we make use of the release hooks
13 that are called every time a tool releases the context object.
14
16 package Test2::Plugin::MyPlugin;
17
18 use Test2::API qw{test2_add_callback_context_release};
19
20 sub import {
21 my $class = shift;
22
23 test2_add_callback_context_release(sub {
24 my $ctx_ref = shift;
25
26 print "Context was released\n";
27 });
28 }
29
30 1;
31
33 use Test2::API qw{test2_add_callback_context_release};
34 This imports the "test2_add_callback_context_release()" callback.
35
36 test2_add_callback_context_release(sub { ... })
37 my $ctx_ref = shift
38 The coderefs for test2_add_callback_context_release() will receive
39 exactly 1 argument, the context being released.
40
41 print "Context was released\n"
42 Print a notification whenever the context is released.
43
45 Test2::Manual - Primary index of the manual.
46
48 The source code repository for Test2-Manual can be found at
49 https://github.com/Test-More/Test2-Suite/.
50
52 Chad Granum <exodist@cpan.org>
53
55 Chad Granum <exodist@cpan.org>
56
58 Copyright 2018 Chad Granum <exodist@cpan.org>.
59
60 This program is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62
63 See http://dev.perl.org/licenses/
64
65
66
67perl v5.28.1 Test220:1:8M-a1n2u-a0l4::Tooling::Plugin::ToolCompletes(3)