sedusedan has asked for the wisdom of the Perl Monks concerning the following question:
I'm just wondering, is there a way for an import hook to cancel/ignore/no-op a require() so that this code works?
unshift @INC, \&import_hook; require Foo; # nothing is loaded require Bar; # nothing is loaded
I've tried:
unshift @INC, sub { return (undef, sub {0}); }
use Tie::Handle::Scalar; unshift @INC, sub { tie *FH, "Tie::Handle::Scalar", ""; # or "1;\n" #$INC{$name} = undef; # or $name. testing return (*FH); }
Perl seems to go to the next @INC entry for all the above two cases. What am I doing wrong?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Cancel/no-op a require (%INC)
by tye (Sage) on Dec 07, 2012 at 14:24 UTC | |
by Anonymous Monk on Dec 08, 2012 at 09:55 UTC | |
Re: Cancel/no-op a require
by tobyink (Canon) on Dec 07, 2012 at 13:16 UTC | |
by sedusedan (Monk) on Dec 07, 2012 at 13:36 UTC | |
by sedusedan (Monk) on Dec 07, 2012 at 14:06 UTC | |
Re: Cancel/no-op a require
by tobyink (Canon) on Dec 07, 2012 at 13:35 UTC | |
by sedusedan (Monk) on Dec 07, 2012 at 13:44 UTC | |
by tobyink (Canon) on Dec 07, 2012 at 14:07 UTC | |
by Pickwick (Beadle) on Dec 30, 2014 at 15:14 UTC |
Back to
Seekers of Perl Wisdom