Don't ask to ask, just ask | |
PerlMonks |
Re: Moose Roles and Overrideby Oberon (Monk) |
on Sep 17, 2019 at 01:58 UTC ( [id://11106271]=note: print w/replies, xml ) | Need Help?? |
(I know I'm replying to a really old thread, but this is still one of the top Google search results for things like "moose role override", so I think it's worth adding a bit to the discussion. Hopefully this is helpful for people who stumble across this in the future.) The reason this feature doesn't (and can't, really) work as edwinorc would hope is that there is no such thing as a "parent role." At composition time, all roles are equal. Regardless of how they got to the composing class, all their guts are just jammed into the class at once (or at least that's how I like to think of it). So this works:
because this works:
On the other hand, this doesn't work:
because this doesn't work:
And likewise this:
is just equivalent to this:
so, again, it can't work. The fact that Top got composed via Bottom doesn't really matter.
In Section
Seekers of Perl Wisdom
|
|