augment and before
[email protected] (Fitz Elliott)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I've discovered something that I'm not sure is a bug or not. It has to do with the interaction between augment/override and before/after/around. The following code crashes with the error message "Cannot add an augment method if a local method is already present":
package Derp;
use Moose;
sub run { inner(); }
1;
package Derp::Herp;
use Moose;
extends 'Derp';
before run => sub { print "before+run()\n"; };
augment run => sub { print "run()\n"; };
1;
Derp::Herp->run;
If you swap the 'before' and the 'augment', it works perfectly. Is this expected behavior, or is this a bug? If it's expected, would it be helpful if I were to write a paragraph about it for the CAVEATS section of Moose::Manual::MethodModifiers? Thanks!
Cheers,
Fitz