Re: Bug / feature / idiot user?
[email protected] (Dave Rolsky)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 22 Sep 2008, Andy Armstrong wrote:
> On 22 Sep 2008, at 14:28, Dave Rolsky 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 Configurable.pm
> package Configurable;
>
> use Moose::Role;
> use Configuration;
>
> has 'config' => (
> handles => ['option'],
> default => sub { Configuration->new },
> );
>
> It (correctly) delegates option to its config attribute. That all works fine.
Ah, sorry, I missed that part.
The problem is that attributes cannot satisfy a "requires" requirement.
The requires check happens before the attributes have a chance to make
their methods.
-dave
/*==========================
VegGuide.Org
Your guide to all that's veg
==========================*/