Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Subroutines with the same name, in different packages

by Anonymous Monk
on Feb 05, 2010 at 18:12 UTC ( #821623=note: print w/ replies, xml ) Need Help??


in reply to Re: Subroutines with the same name, in different packages
in thread Subroutines with the same name, in different packages

Indeed. To the OP: exporting OO methods serves no purpose. Exporting puts the sub into the importer's package, eg main.

But when you call a method, you (usually) use the package name or an instance of that package, eg my $foo = Foo->new(); $foo->frob();. All the calling package (usually) needs to do is to use Foo; so that the class you're going to be using is loaded.

In short: don't export methods.


Comment on Re^2: Subroutines with the same name, in different packages
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2015-07-07 09:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls