The stupid question is the question not asked | |
PerlMonks |
Re: Flexibility in Module for Import or Executeby temporal (Pilgrim) |
on Mar 13, 2013 at 15:11 UTC ( [id://1023226]=note: print w/replies, xml ) | Need Help?? |
Well, if this is the sort of thing that caller was designed for then I'm happy to continue doing what I'm doing. Just never know when there's some useful-but-hidden little convenience built into Perl so I thought I'd ask. Thanks for the affirmation tobyink. At least I now have something to call these code monstrosities thanks to dsheroh. Actually, they're not all that bad - I like how brian d foy refers to them as 'doing double duty' as a module and a script; that's how I view them. His method of implementing this functionality is definitely more elegant:
He then illustrates that double duty these Modulinos are capable of pulling is by allowing submodules to inherit and optionally override the parent subroutines. So if you're into creating object oriented inheritance hierarchy styled code there is definitely some benefit to be had here. Personally, my design ends up with one 'master' Modulino which is used by some number of other scripts. This master Modulino contains all common code plus some optional initialization routines and shared variables via Exporter. I'll usually run it directly for tasks composed entirely of its subroutines. Strange things are afoot at the Circle-K.
In Section
Seekers of Perl Wisdom
|
|