Ivan Tubert-Brohman <[EMAIL PROTECTED]> wrote: > Randy W. Sims wrote: > > Is there a way to make C<require> or C<use> fail without manipulating > > @INC or hiding the physical file? > > Check out Devel::Hide. I've never used it, but it's supposed to do that.
Another strategy is to take advantage of the fact that require fails if a module doesn't end with a true value. Zero-length files work fine for this purpose. In a private lib directory create zero-length files for all the modules you want to fail. For instance to fail on URI::Escape and CGI: $ mkdir -p t/skip_lib/URI $ touch t/skip_lib/URI/Escape.pm $ touch t/skip_lib/CGI.pm $ prove -Ilib -It/skip_lib t/ To simulate different combinations of missing modules create different private directory trees. The advantage of this approach is that you can test both against missing modules and old modules at the same time. For instance, the following scenario scenario tests against an earlier version of CGI::Application (version 3.31) and a missing Digest::SHA1: $ mkdir -p t/prereq_lib/Digest $ mkdir -p t/prereq_lib/CGI $ cp CGI-Application-3.31.pm t/prereq_lib/CGI/Application.pm $ touch t/prereq_lib/Digest/SHA1.pm $ prove -Ilib -It/prereq_lib t/ Michael -- Michael Graham <[EMAIL PROTECTED]>