Thilosophy has asked for the wisdom of the Perl Monks concerning the following question:
Learned monks,
I'd like to prevent modules from being loaded.
Many Perl modules are built on top of other modules, and some even acknowledge that There Is More Than Way To Do It by offering different implementations depending on what helper modules are present. For writing test cases that trigger all possible choices, I would like to pretend that certain modules are not available.
The documentation for require states that require works similar to
which led me to believe that I could doif (exists $INC{$filename}) { return 1 if $INC{$filename}; die "Compilation failed in require"; }
But that does not work. While the module (CGI) is not loaded, the code does not die as it should.use strict; BEGIN{ $INC{'CGI.pm'} = undef; } use CGI;
|
---|
Back to
Seekers of Perl Wisdom