The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Stream::Sync - Primary Synchronization point, this is where global stuff lives.

EXPERIMENTAL CODE WARNING

This is an experimental release! Test-Stream, and all its components are still in an experimental phase. This dist has been released to cpan in order to allow testers and early adopters the chance to write experimental new tools with it, or to add experimental support for it into old tools.

PLEASE DO NOT COMPLETELY CONVERT OLD TOOLS YET. This experimental release is very likely to see a lot of code churn. API's may break at any time. Test-Stream should NOT be depended on by any toolchain level tools until the experimental phase is over.

DESCRIPTION

There is a need to synchronize some details for all tests that run. This package stores these global objects. As little as possible is kept here, when possible things should not be global.

SYNOPSIS

    use Test::Stream::Sync; # No Exports

    my $init  = Test::Stream::Sync->init_done;
    my $stack = Test::Stream::Sync->stack;
    my $ipc   = Test::Stream::Sync->ipc;

CLASS METHODS

This class stores global instances of things. This package is NOT an object, everything that uses it will get the same stuff.

$bool = Test::Stream::Sync->init_done

This will return true if the stack and ipc instances have already been initialized. It will return false if they have not.

$stack = Test::Stream::Sync->stack

This will return the global Test::Stream::Stack instance. If this has not yet been initialized it will be initialized now.

$ipc = Test::Stream::Sync->ipc

This will return the global Test::Stream::IPC instance. If this has not yet been initialized it will be initialized now.

$bool = Test::Stream::Sync->no_wait
Test::Stream::Sync->no_wait($bool)

This can be used to get/set the no_wait status. Waiting is turned on by default. Waiting will cause the parent process/thread to wait until all child processes and threads are finished before exiting. You will almost never want to turn this off.

Test::Stream::Sync->add_hook(sub { ... })

This can be used to add a hook that is called after all testing is done. This is too late to add additional results, the main use of this hook is to set the exit code.

    Test::Stream::Sync->add_hook(
        sub {
            my ($context, $exit, \$new_exit) = @_;
            ...
        }
    );

The $context passed in will be an instance of Test::Stream::Context. The $exit argument will be the original exit code before anything modified it. $$new_exit is a reference to the new exit code. You may modify this to change the exit code. Please note that $$new_exit may already be different from $exit

MAGIC

This package has an END block. This END block is responsible for setting the exit code based on the test results. This end block also calls the hooks that can be added to this package.

SOURCE

The source code repository for Test::Stream can be found at http://github.com/Test-More/Test-Stream/.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright 2015 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html