NAME Test::Stream::Plugin::Hide - Test::Stream Plugin to hide modules for testing purposes. 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 You can use this module to hide modules from require/use. This is useful when testing code branches that are effected by module availability. SYNOPSIS use Test::Stream -V1, Hide => ['Foo::Bar', 'Baz::Bat', ...]; like( dies { require Foo::Bar }, qr/Can't locate 'Foo/Bar\.pm' in \@INC/, "Cannot find Foo::Bar!" ); done_testing; EXPORTS All exports are optional, they can be requested by passing them in as argument with the '-' prefix. You can also use '-all' to import them all. In the Test::Stream use line you can also use the '*' shortcut. use Test::Stream -V1, Hide => '*'; hide 'Foo::Bar'; ... do_hidden { hide Another::One; # Goes away at the end of the block ... } 'Baz::Bat', ...; # These are no longer hidden outside of the block ... unhide 'Foo::Bar'; ... done_testing; hide 'Some::Module', 'Another::Module', ...; Hide the specified modules. If any modules are already loaded an exception will be thrown. unhide 'Some::Module', 'Another::Module, ...; Unhide the specified modules. If you attempted to load the modules then %INC will be cleaned so that you can try to load them again. do_hidden { ... } 'Some::Module', 'Another::Module', ...; This scopes module hides. You can list modules after the codeblock and/or you can call "hide()" inside the block. When the block exits all hides added inside the scope will be unhidden. Note: "unhide()" is NOT scoped, that means anything you unhide inside the block will remain unhidden outside of it. You will have to re-hide anything unhidden within. This is necessary because you generally unhide something to then load it, you can't rehide something you loaded. SEE ALSO Devel::Hide Devel::Hide Test::Without::Module Test::Without::Module SOURCE The source code repository for Test::Stream can be found at http://github.com/Test-More/Test-Stream/. MAINTAINERS Chad Granum AUTHORS Chad Granum COPYRIGHT Copyright 2015 Chad Granum . 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