http://www.perlmonks.org?node_id=407765


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.