TB2::CanLoad - load modules without effecting global variables
package My::Thing; use TB2::Mouse; with "TB2::CanLoad"; My::Thing->load("Some::Module");
Test::Builder2 must be careful to leave the global state of the test alone. This especially includes things like $@ and $!. Unfortunately, a lot of things change them. require is one of them.
require
This module provides load as a safe replacement for require which does not affect global variables (except the obvious ones like %INC).
load
%INC
$class->load($module);
This works like require to load a module, except it will not affect $! and $@ and not trip a $SIG{__DIE__} handler. Use it internally in your test module when you want to load a module.
$!
$@
$SIG{__DIE__}
It will die on failure if the $module fails to load in which case it will set $@. If you want to trap the failure, see TB2::CanTry.
TB2::CanTry
To install Test::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Simple
CPAN shell
perl -MCPAN -e shell install Test::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.