Think about Loose Coupling | |
PerlMonks |
Re: Accessing DEBUG constant from sub-packageby tobyink (Canon) |
on Aug 10, 2013 at 07:06 UTC ( [id://1048883]=note: print w/replies, xml ) | Need Help?? |
Personally I'd do something like this in the Thing package:
This makes your Thing package more re-usable, allowing it to be used in scripts that don't define a DEBUG constant in the main package.
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
In Section
Seekers of Perl Wisdom
|
|