Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Common sub as method or functionby akho (Hermit) |
on Aug 15, 2007 at 16:16 UTC ( [id://632785]=note: print w/replies, xml ) | Need Help?? |
I'd separate them into Module::Base::Util or something like that, then use fully qualified names.
That would make code easier to understand and maintain. Using $self->smth() is wrong because it creates an illusion you are using a method, exporting is usually bad just because it's bad, and Module::Base::smth() is bad because you have to remember which subs are methods and which subs are just there when changing Module::Base. You can put comments and say these subs should not be edited into methods. That convention will be broken despite all the commenting you can do. Utility functions should be separated into their own module.
In Section
Seekers of Perl Wisdom
|
|