Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Subroutines with the same name, in different packages

by toolic (Chancellor)
on Feb 05, 2010 at 17:57 UTC ( #821621=note: print w/ replies, xml ) Need Help??


in reply to Subroutines with the same name, in different packages

Try not exporting those 2 subs:

@EXPORT = ();


Comment on Re: Subroutines with the same name, in different packages
Download Code
Re^2: Subroutines with the same name, in different packages
by Anonymous Monk on Feb 05, 2010 at 18:12 UTC
    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.

Re^2: Subroutines with the same name, in different packages
by AnomalousMonk (Abbot) on Feb 05, 2010 at 19:05 UTC
    Try not exporting those 2 subs ... don't export methods.

    ... and if you cannot redefine what the module exports by default, suppress importation when you use the module.
        use UCP::NLMWriter ();
        use UCP::ManifestWriter ();

      Thanks, all!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-09-23 19:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (239 votes), past polls