1Test::Without::Module(3U)ser Contributed Perl DocumentatiToenst::Without::Module(3)
2
3
4

NAME

6       Test::Without::Module - Test fallback behaviour in absence of modules
7

SYNOPSIS

9         use Test::Without::Module qw( My::Module );
10
11         # Now, loading of My::Module fails :
12         eval { require My::Module; };
13         warn $@ if $@;
14
15         # Now it works again
16         eval q{ no Test::Without::Module qw( My::Module ) };
17         eval { require My::Module; };
18         print "Found My::Module" unless $@;
19

DESCRIPTION

21       This module allows you to deliberately hide modules from a program even
22       though they are installed. This is mostly useful for testing modules
23       that have a fallback when a certain dependency module is not installed.
24
25   EXPORT
26       None. All magic is done via "use Test::Without::Module LIST" and "no
27       Test::Without::Module LIST".
28
29   Test::Without::Module::get_forbidden_list
30       This function returns a reference to a copy of the current hash of
31       forbidden modules or an empty hash if none are currently forbidden.
32       This is convenient if you are testing and/or debugging this module.
33

ONE LINER

35       A neat trick for using this module from the command line was mentioned
36       to me by NUFFIN and by Jerrad Pierce:
37
38         perl -MTest::Without::Module=Some::Module -w -Iblib/lib t/SomeModule.t
39
40       That way, you can easily see how your module or test file behaves when
41       a certain module is unavailable.
42

BUGS

44       ยท   There is no lexical scoping
45

CREDITS

47       Much improvement must be thanked to Aristotle from PerlMonks, he
48       pointed me to a much less convoluted way to fake a module at
49       <http://www.perlmonks.org/index.pl?node=192635>.
50
51       I also discussed with him an even more elegant way of overriding
52       CORE::GLOBAL::require, but the parsing of the overridden subroutine
53       didn't work out the way I wanted it - CORE::require didn't recognize
54       barewords as such anymore.
55
56       NUFFIN and Jerrad Pierce pointed out the convenient use from the
57       command line to interactively watch the behaviour of the test suite and
58       module in absence of a module.
59

AUTHOR

61       Copyright (c) 2003-2009 Max Maischein, <corion@cpan.org>
62

LICENSE

64       This module is released under the same terms as Perl itself.
65

SEE ALSO

67       Devel::Hide, Acme::Intraweb, PAR, perlfunc
68
69
70
71perl v5.12.1                      2009-01-18          Test::Without::Module(3)
Impressum