Subject: | Attribute delegated in one role does not satisfy requires of another role |
Date: | Thu, 24 May 2012 13:03:06 -0400 |
To: | "'bug-Moose [...] rt.cpan.org'" <bug-Moose [...] rt.cpan.org> |
From: | "Maddy, Noel" <NMADDY1 [...] hfhs.org> |
I have one role that provides a method by delegating it to an attribute, and another
role that requires that method. When I try composing those two roles, Moose does
not see the delegated method as satisfying the requires clause.
I'm running Perl 5.14.2 under perlbrew on Fedora 16, with up-to-date CPAN,
including Moose 2.0602.
Here's a simplified example case, which gives the error:
'DelegatedYum|NeedsYum' requires the method 'yum' to be implemented by 'Composed'
package HasYum;
use Moose;
has yum => ( is => 'ro', default => 37 );
package DelegatedYum;
use Moose::Role;
has has_yum => (
is => 'ro',
default => sub { HasYum->new() },
handles => ['yum']
);
package NeedsYum;
use Moose::Role;
requires 'yum';
package Composed;
use Moose;
#with qw{ NeedsYum DelegatedYum };
with qw{ DelegatedYum NeedsYum };
Show quoted text
________________________________
CONFIDENTIALITY NOTICE: This email contains information from the sender that may be CONFIDENTIAL, LEGALLY PRIVILEGED, PROPRIETARY or otherwise protected from disclosure. This email is intended for use only by the person or entity to whom it is addressed. If you are not the intended recipient, any use, disclosure, copying, distribution, printing, or any action taken in reliance on the contents of this email, is strictly prohibited. If you received this email in error, please contact the sending party by reply email, delete the email from your computer system and shred any paper copies.
Note to Patients: There are a number of risks you should consider before using e-mail to communicate with us. See our Privacy Policy and Henry Ford My Health at www.henryford.com for more detailed information. If you do not believe that our policy gives you the privacy and security protection you need, do not send e-mail or Internet communications to us.