TEST2::MANUAL::TOOLING::PLUGIN::TOOLCOMPLETES(3perl)
β¨ NAME β¨
Test2::Manual::Tooling::Plugin::ToolCompletes β it's the Perl Programmers Reference Guide page that teaches you how to add behaviors that happen when a tool completes work π (and yeah, we're in 3perl territory, so you already know this is Perl module docs, bestie)
π¦ DESCRIPTION π¦
okay so bestie, this tutorial is here to help you understand how to add behaviors that occur when a tool is <emphasis>done</emphasis> with its work. periodt.
the β¨loreβ¨ is this: all tools need to acquire and then release a context. so for this tutorial, we're making use of the release hooks that get called every single time a tool releases the context object. every time. no cap. π₯
π COMPLETE CODE UP FRONT π
because we're not gonna make you scroll for the good stuff, here's the whole thing:
package Test2::Plugin::MyPlugin;
use Test2::API qw{test2_add_callback_context_release};
sub import {
my $class = shift;
test2_add_callback_context_release(sub {
my $ctx_ref = shift;
print "Context was released\n";
});
}
1;
π LINE BY LINE π
breaking it all the way down, no crumbs left:
use Test2::API qw{test2_add_callback_context_release};β this imports thetest2_add_callback_context_release()callback. that's it, that's the whole job π«Άtest2_add_callback_context_release(sub { ... })my $ctx_ref = shiftβ the coderefs fortest2_add_callback_context_release()will receive exactly 1 argument, and that argument is the context being released. one. just one. πprint "Context was released\n"β prints a notification whenever the context is released. iconic behavior honestly πβ¨
πΈ SEE ALSO πΈ
- Test2::Manual β the Primary index of the manual. go there, it's giving main character energy π
π§ SOURCE π§
the source code repository for Test2-Manual can be found at https://github.com/Test-More/test-more/ β go peek, iykyk π
π MAINTAINERS π
Chad Granum <exodist@cpan.org>
π AUTHORS π
Chad Granum <exodist@cpan.org>
π COPYRIGHT π
Copyright Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
and that's the whole page bestie, you ate π β¨
signing off from perl v5.44.0, dated 2026-10-17, on the Test2::Manual::Tooling::Plugin::ToolCompletes page (the 3perl one) ππ¦
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms