I don't really have any opinion on whether or not you should be doing this, but...
package C1; use Moose; sub html { my $this = shift; return '<html>' . $this->head . '<body>' . inner() . '</body>' . '</html>'; } sub head { my $self = shift; my $child_implementation = $self->meta->get_method('head'); my $has_child_implementation = blessed($child_implementation) && $child_implementation->isa('Moose::Meta::Method::Augmented' +); return '<head>' . ($has_child_implementation ? inner() : '') . '</ +head>'; } package C2; use Moose; extends 'C1'; augment html => sub { return 'C2'; }; package main; warn C2->new->html;
In reply to Re: Moose - two augmented methods in one class
by tobyink
in thread Moose - two augmented methods in one class
by roman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |