![]() |
![]()
| ![]() |
![]()
NAMETest2::Tools::Exports - Tools for validating exporters. DESCRIPTIONThese are tools for checking that symbols have been imported into your namespace. SYNOPSISuse Test2::Tools::Exports use Data::Dumper; imported_ok qw/Dumper/; not_imported_ok qw/dumper/; EXPORTSAll subs are exported by default.
CAVEATSBefore Perl 5.10, it is very difficult to distinguish between a package scalar that is undeclared vs declared and undefined. Currently "imported_ok" and "not_imported_ok" cannot see package scalars declared using "our $var" unless the variable has been assigned a defined value. This will pass on recent perls, but fail on perls older than 5.10: use Test2::Tools::Exports; our $foo; # Fails on perl onlder than 5.10 imported_ok(qw/$foo/); If $foo is imported from another module, or imported using "use vars qw/$foo/;" then it will work on all supported perl versions. use Test2::Tools::Exports; use vars qw/$foo/; use Some::Module qw/$bar/; # Always works imported_ok(qw/$foo $bar/); SOURCEThe source code repository for Test2-Suite can be found at https://github.com/Test-More/Test2-Suite/. MAINTAINERSAUTHORSCOPYRIGHTCopyright 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/
|