1Devel::Hide(3)        User Contributed Perl Documentation       Devel::Hide(3)
2
3
4

NAME

6       Devel::Hide - Forces the unavailability of specified Perl modules (for
7       testing)
8

SYNOPSIS

10           use Devel::Hide qw(Module/ToHide.pm);
11           require Module::ToHide; # fails
12
13           use Devel::Hide qw(Test::Pod Test::Pod::Coverage);
14           require Test::More; # ok
15           use Test::Pod 1.18; # fails
16
17       Other common usage patterns:
18
19           $ perl -MDevel::Hide=Module::ToHide Makefile.PL
20
21           bash$ PERL5OPT=MDevel::Hide
22           bash$ DEVEL_HIDE_PM='Module::Which Test::Pod'
23           bash$ export PERL5OPT DEVEL_HIDE_PM
24           bash$ perl Makefile.PL
25
26       outputs (like blib)
27
28           Devel::Hide hides Module::Which, Test::Pod, etc.
29

DESCRIPTION

31       Given a list of Perl modules/filenames, this module makes "require" and
32       "use" statements fail (no matter the specified files/modules are
33       installed or not).
34
35       They die with a message like:
36
37           Can't locate Module/ToHide.pm (hidden)
38
39       The original intent of this module is to allow Perl developers to test
40       for alternative behavior when some modules are not available. In a Perl
41       installation, where many modules are already installed, there is a
42       chance to screw things up because you take for granted things that may
43       not be there in other machines.
44
45       For example, to test if your distribution does the right thing when a
46       module is missing, you can do
47
48           perl -MDevel::Hide=Test::Pod Makefile.PL
49
50       forcing "Test::Pod" to not be found (whether it is installed or not).
51
52       Another use case is to force a module which can choose between two
53       requisites to use the one which is not the default.  For example,
54       "XML::Simple" needs a parser module and may use "XML::Parser" or
55       "XML::SAX" (preferring the latter).  If you have both of them
56       installed, it will always try "XML::SAX".  But you can say:
57
58           perl -MDevel::Hide=XML::SAX script_which_uses_xml_simple.pl
59
60       NOTE. This module does not use Carp. As said before, denial dies.
61
62       This module is pretty trivial. It uses a code reference in @INC to get
63       rid of specific modules during require - denying they can be
64       successfully loaded and stopping the search before they have a chance
65       to be found.
66
67       There are three alternative ways to include modules in the hidden list:
68
69       ·   setting @Devel::Hide::HIDDEN
70
71       ·   environment variable DEVEL_HIDE_PM
72
73       ·   import()
74
75       Optionally, you can propagate the list of hidden modules to your
76       process' child processes, by passing '-from:children' as the first
77       option when you use() this module. This works by populating "PERL5OPT",
78       and is incompatible with Taint mode, as explained in perlrun.
79
80   CAVEATS
81       There is some interaction between "lib" and this module
82
83           use Devel::Hide qw(Module/ToHide.pm);
84           use lib qw(my_lib);
85
86       In this case, 'my_lib' enters the include path before the Devel::Hide
87       hook and if Module/ToHide.pm is found in 'my_lib', it succeeds.
88
89       Also for modules that were loaded before Devel::Hide, "require" and
90       "use" succeeds.
91
92       Since 0.0005, Devel::Hide warns about modules already loaded.
93
94           $ perl -MDevel::Hide=Devel::Hide -e ''
95           Devel::Hide: Too late to hide Devel/Hide.pm
96
97   EXPORTS
98       Nothing is exported.
99

ENVIRONMENT VARIABLES

101       DEVEL_HIDE_PM - if defined, the list of modules is added
102          to the list of hidden modules
103
104       DEVEL_HIDE_VERBOSE - on by default. If off, suppresses
105          the initial message which shows the list of hidden modules
106          in effect
107
108       PERL5OPT - used if you specify '-from:children'
109

SEE ALSO

111       "perldoc -f require"
112
113       Test::Without::Module
114

BUGS

116       Please report bugs via CPAN RT
117       <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Devel-Hide>.
118

AUTHORS

120       Adriano R. Ferreira, <ferreira@cpan.org>
121
122       with contributions from David Cantrell <dcantrell@cpan.org>
123
125       Copyright (C) 2005-2007, 2018 by Adriano R. Ferreira
126
127       This library is free software; you can redistribute it and/or modify it
128       under the same terms as Perl itself.
129
130
131
132perl v5.28.1                      2018-06-15                    Devel::Hide(3)
Impressum