Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by jacques (Priest)
on Jul 04, 2008 at 19:24 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://695627]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found