BEGIN {
$MooseX::ClassAttribute::Trait::Application::ToClass::VERSION
=
'0.23'
;
}
around
apply
=>
sub
{
my
$orig
=
shift
;
my
$self
=
shift
;
my
$role
=
shift
;
my
$class
=
shift
;
$class
= Moose::Util::MetaRole::apply_metaroles(
for
=>
$class
,
class_metaroles
=> {
class
=> [
'MooseX::ClassAttribute::Trait::Class'
],
},
);
$self
->
$orig
(
$role
,
$class
);
};
sub
_apply_class_attributes {
my
$self
=
shift
;
my
$role
=
shift
;
my
$class
=
shift
;
my
$attr_metaclass
=
$class
->attribute_metaclass();
foreach
my
$attribute_name
(
$role
->get_class_attribute_list() ) {
if
(
$class
->has_class_attribute(
$attribute_name
)
&&
$class
->get_class_attribute(
$attribute_name
)
!=
$role
->get_class_attribute(
$attribute_name
) ) {
next
;
}
else
{
$class
->add_class_attribute(
$role
->get_class_attribute(
$attribute_name
)
->attribute_for_class(
$attr_metaclass
) );
}
}
}
1;