Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Need help with clashing method names

by ikegami (Patriarch)
on Feb 13, 2009 at 14:49 UTC ( [id://743610]=note: print w/replies, xml ) Need Help??


in reply to Need help with clashing method names

It's not uncommon to have third-party modules to export names,

I always explicitly specify the functions I import for other reasons, so it doesn't matter what third-party modules export.

use B qw( ); # Import nothing
use B qw( foo bar ); # but not moo

It doesn't solve the problem, but it limits the chance of it happening.

use B qw( moo ); # doh!

If you were paranoid, you could import as follows:

use B qw( ); BEGIN { *_moo = \&B::moo; }

Then the imported sub will be named _moo. But I don't think it's worth the effort.

Replies are listed 'Best First'.
Re^2: Need help with clashing method names
by dk (Chaplain) on Feb 13, 2009 at 18:34 UTC
    Indeed, explicit specification is a tiny bit better than implicit like tag-based ":all" etc, but it still doesn't solve problem if the imported name will be used in the next version of the parent class, for example.

    I've sent a patch to initiate a discussion in perl5-porters, we'll see how it goes.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-26 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found