Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^2: Variables in Common parent classby tobyink (Canon) |
on Mar 10, 2013 at 06:34 UTC ( [id://1022647]=note: print w/replies, xml ) | Need Help?? |
All generally good advice, but for the constructors in the children, I'd prefer:
This ensures that the parent constructor is called as a method (and thus obeys inheritance). There's no need to re-bless $self.
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
In Section
Seekers of Perl Wisdom
|
|