Re: Bug / feature / idiot user?
[email protected] (Dave Rolsky)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 22 Sep 2008, Andy Armstrong wrote:
> I've finally buckled to peer pressure and adopted Moose. So far I /really/
> like it. Thanks.
>
> I'm having a problem that may well just be me doing something silly. Given
> the following:
>
> $ cat Configurable.pm
> package Configurable;
>
> use Moose::Role;
> use Configuration;
This _loads_ Configuration, which provides an option method. It doesn't
import said methods or anything like that.
> $ cat Thing.pm
> package Thing;
>
> use Moose;
>
> with 'Configurable', 'Loggable';
>
> sub run { shift->log }
So when you get here, you still haven't implemented an option method in
Thing.
> If I uncomment the implementation of C<option> in Configurable.pm it works
> just fine - and delegates correctly to the C<option> in Configuration.pm.
>
> If I comment out the 'requires' in Loggable it also works fine.
>
> So I guess the combination of delegation and role composition puts the
> implementation of C<option> out of reach to requires?
>
> Am I doing something silly?
Yes, definitely ;)
I have no idea what you expect Moose to be doing here, honestly.
-dave
/*==========================
VegGuide.Org
Your guide to all that's veg
==========================*/