Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Just another Perl shrine
 
PerlMonks  

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

by etcshadow (Priest)
on Nov 14, 2004 at 23:09 UTC ( [id://407765]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 14, 2004 at 23: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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://407765]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.