Subject: | Consuming a Moo::Role from a Moose class doesn't bring in methods consumed by the role |
Latest $VERSION of Moo, Role::Tiny, Moose.
If I consume a Moo::Role ('A') from a Moo::Role ('B') and then consume
role 'B' from a Moo class, life is grand \o/
... but the same deal except consuming 'B' from a Moose class appears to
never copy methods defined in role 'A'
The failing test in question (nothing in the author suite seems to
exactly test this scenario):
use Test::More tests => 4;
use strict; use warnings FATAL => 'all';
{ package My::Role::A; use Moo::Role;
sub things { 1 }
}
{ package My::Role::B; use Moo::Role;
with 'My::Role::A';
}
{ package My::Moo::Class;
use Test::More;
use Moo;
with 'My::Role::B';
}
{
package My::Moose::Class;
use Test::More;
use Moose;
with 'My::Role::B';
}
my $moo = My::Moo::Class->new;
ok( $moo->does('My::Role::A'), "Moose class does My::Role::A" );
ok( $moo->can('things'), "can things() with Moo" );
my $moose = My::Moose::Class->new;
## does() passes:
ok( $moose->does('My::Role::A'), "Moose class does My::Role::A" );
## but can() fails and the method is not found:
ok( $moose->can('things'), "can things() with Moose" );