++ed by:
LUKAST DAGOLDEN BEROV PATTAWAN SMITHFARM

90 PAUSE users
53 non-PAUSE users.

Chad Granum

NAME

Test2::Util - Tools used by Test2 and friends.

DESCRIPTION

Collection of tools used by Test2 and friends.

EXPORTS

All exports are optional. You must specify subs to import.

($success, $error) = try { ... }

Eval the codeblock, return success or failure, and the error message. This code protects $@ and $!, they will be restored by the end of the run. This code also temporarily blocks $SIG{DIE} handlers.

protect { ... }

Similar to try, except that it does not catch exceptions. The idea here is to protect $@ and $! from changes. $@ and $! will be restored to whatever they were before the run so long as it is successful. If the run fails $! will still be restored, but $@ will contain the exception being thrown.

CAN_FORK

True if this system is capable of true or pseudo-fork.

CAN_REALLY_FORK

True if the system can really fork. This will be false for systems where fork is emulated.

CAN_THREAD

True if this system is capable of using threads.

USE_THREADS

Returns true if threads are enabled, false if they are not.

get_tid

This will return the id of the current thread when threads are enabled, otherwise it returns 0.

my $file = pkg_to_file($package)

Convert a package name to a filename.

NOTES && CAVEATS

5.10.0

Perl 5.10.0 has a bug when compiled with newer gcc versions. This bug causes a segfault whenever a new thread is launched. Test2 will attempt to detect this, and note that the system is not capable of forking when it is detected.

Devel::Cover

Devel::Cover does not support threads. CAN_THREAD will return false if Devel::Cover is loaded before the check is first run.

SOURCE

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

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>
Kent Fredric <kentnl@cpan.org>

COPYRIGHT

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