![]() |
|
Think about Loose Coupling | |
PerlMonks |
Re: Better way to define global variablesby kcott (Chancellor) |
on Jul 25, 2013 at 14:36 UTC ( #1046360=note: print w/replies, xml ) | Need Help?? |
G'day govindkailas, It's generally not a good idea to export by default (i.e. with @EXPORT) — see the Exporter documentation sections: Selecting What to Export and What Not to Export. Instead, consider using @EXPORT_OK and %EXPORT_TAGS. Here's an example of Utilities.pm that does that:
Here's some sample runs showing how to use it. No namespace pollution unless specifically requested:
Request a specific item:
Request multiple items using a tag:
Mix specific and tag requests:
-- Ken
In Section
Seekers of Perl Wisdom
|
|