.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Test::Without::Module 3pm" .TH Test::Without::Module 3pm "2022-12-16" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Test::Without::Module \- Test fallback behaviour in absence of modules .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Test::Without::Module qw( My::Module ); \& \& # Now, loading of My::Module fails : \& eval { require My::Module; }; \& warn $@ if $@; \& \& # Now it works again \& eval q{ no Test::Without::Module qw( My::Module ) }; \& eval { require My::Module; }; \& print "Found My::Module" unless $@; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module allows you to deliberately hide modules from a program even though they are installed. This is mostly useful for testing modules that have a fallback when a certain dependency module is not installed. .SS "\s-1EXPORT\s0" .IX Subsection "EXPORT" None. All magic is done via \f(CW\*(C`use Test::Without::Module LIST\*(C'\fR and \&\f(CW\*(C`no Test::Without::Module LIST\*(C'\fR. .SS "Test::Without::Module::get_forbidden_list" .IX Subsection "Test::Without::Module::get_forbidden_list" This function returns a reference to a copy of the current hash of forbidden modules or an empty hash if none are currently forbidden. This is convenient if you are testing and/or debugging this module. .SH "ONE LINER" .IX Header "ONE LINER" A neat trick for using this module from the command line was mentioned to me by \s-1NUFFIN\s0 and by Jerrad Pierce: .PP .Vb 1 \& perl \-MTest::Without::Module=Some::Module \-w \-Iblib/lib t/SomeModule.t .Ve .PP That way, you can easily see how your module or test file behaves when a certain module is unavailable. .SH "BUGS" .IX Header "BUGS" .IP "\(bu" 4 There is no lexical scoping .SH "CREDITS" .IX Header "CREDITS" Much improvement must be thanked to Aristotle from PerlMonks, he pointed me to a much less convoluted way to fake a module at . .PP I also discussed with him an even more elegant way of overriding CORE::GLOBAL::require, but the parsing of the overridden subroutine didn't work out the way I wanted it \- CORE::require didn't recognize barewords as such anymore. .PP \&\s-1NUFFIN\s0 and Jerrad Pierce pointed out the convenient use from the command line to interactively watch the behaviour of the test suite and module in absence of a module. .SH "AUTHOR" .IX Header "AUTHOR" Copyright (c) 2003\-2014 Max Maischein, .SH "LICENSE" .IX Header "LICENSE" This module is released under the same terms as Perl itself. .SH "REPOSITORY" .IX Header "REPOSITORY" The public repository of this module is . .SH "SUPPORT" .IX Header "SUPPORT" The public support forum of this module is . .SH "BUG TRACKER" .IX Header "BUG TRACKER" Please report bugs in this module via the \s-1RT CPAN\s0 bug queue at or via mail to test\-without\-module\-Bugs@rt.cpan.org. .SH "SEE ALSO" .IX Header "SEE ALSO" Devel::Hide, Acme::Intraweb, \s-1PAR\s0, perlfunc