Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Test2::Manual::Tooling::Plugin::ToolCompletes

Name Test2::Manual::Tooling::Plugin::ToolCompletes
Version 0.000144
Located at /usr/local/share/perl5
File /usr/local/share/perl5/Test2/Manual/Tooling/Plugin/ToolCompletes.pm
Is Core No
Search CPAN for this module Test2::Manual::Tooling::Plugin::ToolCompletes
Documentation Test2::Manual::Tooling::Plugin::ToolCompletes
Module Details Test2::Manual::Tooling::Plugin::ToolCompletes

NAME

Test2::Manual::Tooling::Plugin::ToolCompletes - How to add behaviors that occur when a tool completes work.


DESCRIPTION

This tutorial helps 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, for this tutorial we make use of the release hooks that are called every time a tool releases the context object.


COMPLETE CODE UP FRONT

    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 the test2_add_callback_context_release() callback.

test2_add_callback_context_release(sub { ... })
my $ctx_ref = shift
The coderefs for test2_add_callback_context_release() will receive exactly 1 argument, the context being released.

print "Context was released\n"
Print a notification whenever the context is released.


SEE ALSO

the Test2::Manual manpage - Primary index of the manual.


SOURCE

The source code repository for Test2-Manual can be found at https://github.com/Test-More/Test2-Suite/.


MAINTAINERS

Chad Granum


AUTHORS

Chad Granum <exodist@cpan.org>Chad Granum


COPYRIGHT

Copyright 2018 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/

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024