Require?

What is a require?


A require is a Test2 module that will skip the current test if a condition is not met.


These are useful if you have tests that require other modules, or should only be run on specific platforms.

AuthorTesting

Test2::Require::AuthorTesting


Skip the test unless the AUTHOR_TESTING environment variable is set.


EnvVar

Test2::Require::EnvVar


Skip the test unless the specified environment variable is set.


Fork

Test2::Require::Fork

Only run tests on systems that can fork, or emulate fork. Checking for forking yourself is not as trivial as it may sound:
RealFork

Test2::Require::RealFork


Only run tests on systems that can fork for real.


Checking yourself is not that hard, but does your intentions are not as clear: Did you actually want to run only when real forking is available, or did you intend to include emulated fork?

Module

Test2::Require::Module


Only run the test if the required module (and optionally version) is installed.


Perl

Test2::Require::Perl


Skip the test unless the necessary version of perl is installed.


Threads

Test2::Require::Threads


Only run tests on perls that have threading enabled.


Checking for threads yourself is not as trivial as it may sound: