Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Namespaces & colliding namesby kcott (Archbishop) |
on Nov 08, 2016 at 09:26 UTC ( [id://1175528]=note: print w/replies, xml ) | Need Help?? |
G'day jahero, Welcome to the Monastery. ++Athanasius showed in his response how to stop all imports with:
However, there may be cases where you only want to stop some, but not all, imports. Still using File::Basename as an example, let's say you wanted its dirname() function. You can specify importation of that function like this:
Module documentation will often identify which functions are exported by default and which are optionally exported; however, presence of this information is by no means guaranteed. You can check for yourself by looking at the source code: @EXPORT lists the default exports and @EXPORT_OK lists the optional ones. For example, the File::Basename source code shows four default exports:
See Exporter for a lot more information on this including advanced features. For instance, to exclude basename() only, you could write:
— Ken
In Section
Seekers of Perl Wisdom
|
|