Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Namespaces & colliding names

by Athanasius (Archbishop)
on Nov 08, 2016 at 08:24 UTC ( [id://1175521]=note: print w/replies, xml ) Need Help??


in reply to Namespaces & colliding names

Hello jahero, and welcome to the Monastery!

You can control what is imported by specifying imports explicitly as part of the use declaration. For example, if you change your code to:

use File::Basename ();

then the basename function in File::Basename will not be imported, so defining your own sub basename will not produce a namespace collision. If you then wanted to call the function of that name in File::Basename, you would need to qualify it fully:

File::Basename::basename(...);

See the documentation for use.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Namespaces & colliding names
by Anonymous Monk on Nov 08, 2016 at 09:15 UTC

    Yes, this helps. Thank you for explanation!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-23 22:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found