Replying to myself... you might want to factor out some of that augmentation detection code if you're going to be doing this a lot...
package AugmentationDetective; use Moose::Role; sub is_augmented { my ($self, $method_name) = @_; my $method = $self->meta->get_method($method_name); return blessed($method) && $method->isa('Moose::Meta::Method::Augmented'); } package C1; use Moose; with 'AugmentationDetective'; sub html { my $this = shift; return '<html>' . $this->head . '<body>' . inner() . '</body>' . '</html>'; } sub head { my $self = shift; return '<head>'.($self->is_augmented('head')?inner():'').'</head>'; } package C2; use Moose; extends 'C1'; augment html => sub { return 'C2'; }; package main; warn C2->new->html;
In reply to Re^2: Moose - two augmented methods in one class
by tobyink
in thread Moose - two augmented methods in one class
by roman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |