Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to alias a whole namespace to another namespace (in this case main::)

by etcshadow (Priest)
on Nov 15, 2004 at 04:09 UTC ( #407765=note: print w/replies, xml ) Need Help??


in reply to How to alias a whole namespace to another namespace (in this case main::)

Look into exporting. Basically, it's an easy way to tell a module, when used, to place its symbols in the namespace of the module which uses it.

So basically, you'd convert your requires into uses, and add a few lines of code to the top of each of your "libraries" (now called "modules" by the changes you'd be making).

I know it's not exactly what you're asking, but it's an approach that leads you down the direction you seem to be heading, so that's good. Also, it's generally the way that this sort of thing is done, these days (exporting symbols from one namespace into another).

------------ :Wq Not an editor command: Wq

Replies are listed 'Best First'.
Re^2: How to alias a whole namespace to another namespace (in this case main::)
by aufflick (Deacon) on Nov 15, 2004 at 04:35 UTC
    You are completely correct, but there is a LOT of legacy files, some of which have multi-level require's, and I'm not going to update them all at one time. It would take too much time and be too dangerous.

    This way all the developers here can gradually "modernise" code as they go without breaking older code.

      Could the original required file be changed to just have the "use module" statement. So all the files that require the old file now are "use"ing the module along with the exports.


Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2019-05-23 19:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (146 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!