BEGIN {
$MooseX::ClassAttribute::Trait::Application::ToRole::VERSION
=
'0.22'
;
}
sub
_apply_class_attributes {
my
$self
=
shift
;
my
$role1
=
shift
;
my
$role2
=
shift
;
$role2
= Moose::Util::MetaRole::apply_metaroles(
for
=>
$role2
,
role_metaroles
=> {
role
=> [
'MooseX::ClassAttribute::Trait::Role'
],
application_to_class
=>
[
'MooseX::ClassAttribute::Trait::Application::ToClass'
],
application_to_role
=>
[
'MooseX::ClassAttribute::Trait::Application::ToRole'
],
},
);
foreach
my
$attribute_name
(
$role1
->get_class_attribute_list() ) {
if
(
$role2
->has_class_attribute(
$attribute_name
)
&&
$role2
->get_class_attribute(
$attribute_name
)
!=
$role1
->get_class_attribute(
$attribute_name
) ) {
Moose->throw_error(
"Role '"
.
$role1
->name()
.
"' has encountered a class attribute conflict "
.
"during composition. This is fatal error and cannot be disambiguated."
);
}
else
{
$role2
->add_class_attribute(
$role1
->get_class_attribute(
$attribute_name
)->clone() );
}
}
}
1;