Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Reloading modules more than once

by Zaxo (Archbishop)
on Aug 04, 2002 at 07:03 UTC ( [id://187464]=note: print w/replies, xml ) Need Help??


in reply to Reloading modules more than once

Two other issues come into this. What is imported? What namespaces do we subclass?

An old style 'foo.pl' library by default exports everything it defines, so two requires may act as you fear, except that the last executed require provides the visible &todo. Perl modules are expected to establish their own namespace and not walk on each other's definitions.

In your example, something.pm may call itself package something; internally, so its &todo is addressed as &something::todo while the other is addressed as 'different::todo(@things). Calling require happens at runtime, so you may need to import the routines you want.

If you place the module namespace on your own namespace's @ISA at some time, you inherit whichever &todo appears first in a depth-first search of @ISA.

After Compline,
Zaxo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-16 11:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found