Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Cancel/no-op a require (%INC)

by tye (Cardinal)
on Dec 07, 2012 at 14:24 UTC ( #1007748=note: print w/ replies, xml ) Need Help??


in reply to Cancel/no-op a require

If making 'use Foo' and 'require Bar' be no-ops is your primary goal, then it is easier to not do that via a hook in @INC (use %INC instead):

BEGIN { $INC{'Foo.pm'} = $INC{'Bar.pm'} = __FILE__ } use Foo; # no-op require Bar; # no-op

- tye        


Comment on Re: Cancel/no-op a require (%INC)
Download Code
Replies are listed 'Best First'.
Re^2: Cancel/no-op a require (%INC, Module::Loaded - mark modules as loaded or unloaded )
by Anonymous Monk on Dec 08, 2012 at 09:55 UTC
    Module::Loaded - mark modules as loaded or unloaded
    use Module::Loaded; $bool = mark_as_loaded('Foo'); # Foo.pm is now marked as loaded $loc = is_loaded('Foo'); # location of Foo.pm set to the # loaders location eval "require 'Foo'"; # is now a no-op $bool = mark_as_unloaded('Foo'); # Foo.pm no longer marked as loaded eval "require 'Foo'"; # Will try to find Foo.pm in @INC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007748]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2015-07-29 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls