Hi all,
I'm wondering if this is a known bug or a misunderstanding on my part (I assume
the latter):
use 5.10.0;
{ package Role::A; use Moose::Role; with 'Role::C'; }
{ package Role::B; use Moose::Role; with 'Role::C'; }
{ package Role::C; use Moose::Role; with 'Role::D'; }
{
package Role::D;
use Moose::Role;
sub foo {
my $proto = shift;
my $class = ref $proto // $proto;
return "$class\::foo";
}
}
package Consume;
use Moose;
with qw(Role::A Role::B);
say Moose->VERSION;
say Consume->foo;
That prints out:
2.0402
Can't locate object method "foo" via package "Consume" at roles.pl line 19.
Given that Role::C uses Role::D and the latter provides the 'foo()' method,
that method should be provided to both Role::A and Role::B since they each
consume Role::C. When consuming those roles, the Consume class should then have
the 'foo()' method, but it does not.
Did I misunderstand something? (For the curious, my Role::Basic module has the
same bug).
Cheers,
Ovid
--
Live and work overseas - http://overseas-exile.blogspot.com/
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://blogs.perl.org/users/ovid/
Twitter - http://twitter.com/OvidPerl/