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

Re^2: Automatically importing a subroutine for a particular namespace

by jacques (Priest)
on Jul 04, 2008 at 19:24 UTC ( #695627=note: print w/ replies, xml ) Need Help??


in reply to Re: Automatically importing a subroutine for a particular namespace
in thread Automatically importing a subroutine for a particular namespace

Note that this package does not have to be a base class of anything. You only have to use it wherever it's needed

That's what I am trying to get away from... How can I tell perl to use something under a particular package without declaring it under that package? (I want to be lazy ...)

Basically, I want to tell perl: "Hey, see that package name? For any package name you find like that, go ahead and make use of this...".


Comment on Re^2: Automatically importing a subroutine for a particular namespace
Re^3: Automatically importing a subroutine for a particular namespace
by Anonymous Monk on Jul 05, 2008 at 01:28 UTC
      That looks like exactly what I wanted. Thanks!
        Note that you would have to take care that the exporting takes place at the right time (which would be before the packages are loaded) if you want to have the same semantics as my solution. That's completely possible, of course (at least if you're not making it too complicated), but it may lead to confusion and/or spurious warnings if you're doing it wrong.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (13)
As of 2014-07-23 14:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (145 votes), past polls