|Perl: the Markov chain saw|
Re^4: Correct syntax for using $INC to keep modules in same fileby perl-diddler (Hermit)
|on Oct 13, 2012 at 22:36 UTC||Need Help??|
Reading through old stuff...(I sometimes do)...
I do not understand what you are trying to say.
use mem, which for simple assignments, I've found can be more easily simplified to:
is a substitute for the UGLY BEGIN block. If there is a more structured way to do it that is prettier, please tell me, but I find BEGIN blocks to be ugly -- I don't like all caps keywords -- they are hard to type and bother my RSI when I do it. So I tend to find lower cost workarounds.
But the bit you said about "use mem 'Dbg'" -- I don't understand -- are you thinking or saying that such would be a substitute for the previously mentioned code or that I should write a separate module to make it so? If it is the latter, yeah, I could, but its a tradeoff. Any module that doesn't have mem in it's library path can recreated it in 1 line:
After that, I can use mem and anything on it's parameter line will be evaluated at BEGIN time without all those ugly BEGIN blocks.
The most common usage I have for use mem (besides assigning to INC so a module in the same file doesn't have to be loaded), is to assign to ISA and EXPORT at BEGIN time, so various modules, including Exporter will work correctly.
Exporter won't work fully if you don't do that. It will include the functions you want -- but not their types. I try to always use typed functions. You only get the benefit of that typing if you have your EXPORT list included at BEGIN time.... usemem does that.
So I'm not sure what you are suggesting I write a module that would have to be included to provide syntactic sugar so it looks nicer? (not necessarily a bad thing, but right now utility beats pretty... pretty comes after it's working -- and I do go back and pretty up code...but usually on a 2nd revision...1st revision is to get it working)...
Is that wrong, or what are you suggesting?