On Sat Jul 25 12:44:48 2009, SARTAK wrote:
Show quoted text> I'm pretty sure I know why this is happening.
>
> If Role uses Package::That::Consumes::Me, that's usually at the top of
> the file, before any methods are defined. So Moose sees that the role is
> empty, since methods haven't had a chance to be defined yet. Both "use"
> and "sub" happen at compile time, remember.
>
> Changing this to "require Package::That::Consumes::Me" should fix it.
>
> I don't know how we can even detect this kind of thing in Moose.
>
> Shawn
I think that it is best to throw a warning, but I'm not too sure of the
internals of Moose. It seems that the scope of 'with' should be able to
detect at some point what the direct dependencies are (I'm not sure if
you can do this in Perl, but it seems like you should).
I don't think that this behavior should be supported, but if there was a
warning I'd be thrilled.
It would have saved me a lot of puzzling refactor time :)
-J