Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Interesting WTDI

by monoxide (Beadle)
on Nov 09, 2004 at 22:22 UTC ( #406541=note: print w/ replies, xml ) Need Help??


in reply to Interesting WTDI

Hmmm... I have no jewels of wisdom, but i was just wondering...

Would it be possible to create/implement your own namespaces by using similar code to the Test::MockObject which is provided above? Kind of like, (guessing here...)

$INC{"MyModule.pm"} = 1; # "load" module *{"MyModule::TestSub"} = /&TestSub; # "load" a method
Would that be correct?


Comment on Re: Interesting WTDI
Download Code
Re^2: Interesting WTDI
by Jenda (Abbot) on Nov 09, 2004 at 22:57 UTC
    $INC{"MyModule.pm"} = 1; # "load" module *MyModule::TestSub = \&TestSub; # "load" a method

    Jenda
    We'd like to help you learn to help yourself
    Look around you, all you see are sympathetic eyes
    Stroll around the grounds until you feel at home
       -- P. Simon in Mrs. Robinson

Re^2: Interesting WTDI
by chromatic (Archbishop) on Nov 10, 2004 at 04:21 UTC

    You only need to set a key in %INC if you want to prevent use or require from attempting to load a module from disk. (You could also put a coderef in @INC, but this way is a lot simpler.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (18)
As of 2015-07-06 12:35 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 (74 votes), past polls