Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: To module or not?

by japhy (Canon)
on Apr 26, 2005 at 14:17 UTC ( #451581=note: print w/replies, xml ) Need Help??


in reply to To module or not?

In your case, there's not much of a problem. The reason modules (and namespaces) exist is becuse related functions belong packaged together, and you should have ability to use a function from another namespace that might end up conflicting with a function in your namespace.

If you had an add_it() function that you didn't want overwritten, you could use your module as

use MyModule; print MyModule::add_it($amount);
And when multiple modules have the same function names (this is most common with classes -- objects, I mean), they need to be able to keep their own functions separate to themselves.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://451581]
help
Chatterbox?
[1nickt]: What do you all think of experimental = refaliasing ? Anyone using it?
[1nickt]: \my %foo = { bar => 1 }; say $foo{bar};

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2017-11-17 20:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?