1 package MooseX::ClassAttribute::Trait::Application::ToClass;
8 use namespace::autoclean;
11 with 'MooseX::ClassAttribute::Trait::Application';
13 sub _apply_class_attributes {
18 $class = Moose::Util::MetaRole::apply_metaclass_roles(
21 class => ['MooseX::ClassAttribute::Trait::Class'],
25 my $attr_metaclass = $class->attribute_metaclass();
27 foreach my $attribute_name ( $role->get_class_attribute_list() ) {
28 if ( $class->has_class_attribute($attribute_name)
29 && $class->get_class_attribute($attribute_name)
30 != $role->get_class_attribute($attribute_name) ) {
34 $class->add_class_attribute(
35 $role->get_class_attribute($attribute_name)
36 ->attribute_for_class($attr_metaclass) );
49 MooseX::ClassAttribute::Trait::Application::ToClass - A trait that supports applying class attributes to classes
53 This trait is used to allow the application of roles containing class
54 attributes to classes.
58 Dave Rolsky, C<< <autarch@urth.org> >>
62 See L<MooseX::ClassAttribute> for details.
64 =head1 COPYRIGHT & LICENSE
66 Copyright 2007-2010 Dave Rolsky, All Rights Reserved.
68 This program is free software; you can redistribute it and/or modify
69 it under the same terms as Perl itself.