Test2::...ompletes(3)
πΈ NAME πΈ
Okay bestie, this is the Test2::...ompletes(3) page from User Contributed Perl Documentation, and the manual itβs serving is Test2::Manual::Tooling::Plugin::ToolCompletes β literally how to add behaviors that occur when a tool completes work. β¨
π¦ DESCRIPTION π¦
This tutorial is here to help you understand how to add behaviors that occur when a tool is done with its work. All tools need to acquire and then release a context, and for this tutorial we make use of the release hooks that are called every time a tool releases the context object. Lowkey iconic plumbing, ngl. π
π COMPLETE CODE UP FRONT π
Hereβs the whole vibe up front, no cap:
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 π
use Test2::API qw{test2_add_callback_context_release};β this imports thetest2_add_callback_context_release()callback. Slay, thatβs the entry point. β¨test2_add_callback_context_release(sub { ... })/my $ctx_ref = shiftβ the coderefs fortest2_add_callback_context_release()will receive exactly 1 argument, the context being released. One argument. Not two. Not a secret third thing. πprint "Context was released\n"β this prints a notification whenever the context is released. Cute little βit happenedβ moment, fr fr. π«Ά
π SEE ALSO π
Test2::Manualβ primary index of the manual. Go browse, bestie. π
π SOURCE π
The source code repository for Test2-Manual can be found at https://github.com/Test-More/test-more/. Thatβs the link. Periodt. π₯
π§ 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/
Okay thatβs the whole page, bestie π β source/version + date check: perl v5.42.0, 2025-07-28, and the page is Test2::...ompletes(3). periodt β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Test-Simple 1.302214-bp160.1.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms