When combining roles based on MooseX::Role::Parameter with others using
normal Moose::Role within a single 'with' statement, the parameterized
roles do not load correctly. When done seperately, they do. The
following case demonstrates the issue:
===
package ParameterizedRole;
use MooseX::Role::Parameterized;
parameter xxx => (
isa => 'Str',
required => 1,
);
role {
my ( $p ) = @_;
die "dying in ParameterizedRole::role";
};
package UnparameterizedRole;
use Moose::Role;
has yyy => (
isa => 'Str',
required => 1,
);
package Consumer;
use Moose;
with 'ParameterizedRole' => { xxx => 1 },
'UnparameterizedRole';
package main;
my $con = Consumer->new( xxx => 1, yyy => 2 );
===
This should die with an error of 'dying in ParameterizedRole::role', but
instead silently continues on. If the 'with' statements are split up,
the expected behaviour occours (die with 'dying in
ParameterizedRole::role at bug.pl line 13.').
By requiring multiple with statements, the benefit of a single 'with'
for noticing that two roles both implement the same method, without
requiring it to be disambiguated by the consumer of the roles doesn't
happen (more a Moose issue itself, but made more likely with the
behaviour of this class).
Mark.