Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Fixed a year later...by tobyink (Canon) |
on Mar 26, 2013 at 09:54 UTC ( [id://1025480]=note: print w/replies, xml ) | Need Help?? |
Personally I'd do this:
I don't have any problem with the BEGIN block. I'd always wrap inline packages in braces anyway, so it's just five extra letters before the opening brace. If I want to factor out MyUtils into a separate file, it's just a matter of cutting everything inside the braces and pasting it into MyUtils.pm; then replace the now empty BEGIN {} block with use MyUtils;. Easy. (And if I was being a perfectionist, I could remove no thanks; from MyUtils.pm as it becomes superfluous.)
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
In Section
Seekers of Perl Wisdom
|
|