Subject: | Can't override stubbed method with delegated method |
Date: | Wed, 3 Aug 2011 13:30:42 -0400 |
To: | bug-moose [...] rt.cpan.org |
From: | Mark Dominus <mjd [...] icgroup.com> |
Consider this trivial example:
Show quoted text
> package Role;
> use Moose::Role;
>
> requires 'method';
>
> package Bug;
> use Moose;
>
> with ('Role');
>
> has member => (
>
> is => 'ro',
> isa => 'Str',
> handles => { method => 'blah' },
>
> );
>
> 1;
This fails with:
'Role' requires the method 'method' to be implemented by 'Bug'
because the "with" directive is processed before the "has" directive. Okay,
fine.
The usual workaround for this is to add a stub:
sub method;
this satisfies the "requires" directive from the role, but runs into another
problem:
You cannot overwrite a locally defined method (method) with a delegation
In this case, this is erroneous. I should be able to overwrite a locally-
defined method if it is a stub. Please fix this.
The only workaround I have found is to put the "with" after the "has", which I
don't like.
I am using Moose 2.0005.
Message body is not shown because sender requested not to inline it.