Welcome to the Monastery | |
PerlMonks |
Re: Call Grandparent Method, Skipping Parentby tobyink (Canon) |
on Jun 20, 2013 at 11:53 UTC ( [id://1039962]=note: print w/replies, xml ) | Need Help?? |
Just hardcode the package name you wish to skip to:
Example:
Here's an alternative Monkey::foo sub that avoids hard-coding the Mammal class name:
Or even:
Note that mro requires Perl 5.10 or better, but there exists a MRO::Compat that provides an alternative implementation of mro::get_linear_isa for Perl 5.8.
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
In Section
Seekers of Perl Wisdom
|
|