Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Exporting functions into main namespace for the benefit of other use'd modules

by tedrek (Pilgrim)
on Jul 10, 2003 at 20:02 UTC ( #273117=note: print w/replies, xml ) Need Help??


in reply to Exporting functions into main namespace for the benefit of other use'd modules

My first reaction is that this is a bad idea, it means that your modules are relying on certain functions to exist in the 'main' namespace. It would seem to me to be clearer to simply have a use Foo::Utility qw/:common/; at the top of each of these modules, that means your modules are only relying on things they have control over. That also has the benefit of meaning you can now say

my $id = get_id();

That alone will probably save you typing, which seems to be what you were worried about in the first place. If you were worried about actually loading the module multiple times, don't, perl only loads it once.

Exporter will give you everything you need to do in Foo::Utility with very little effort (if you weren't already aware of it).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2021-09-16 18:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?