1 package MooseX::ClassAttribute::Trait::Application::ToInstance;
8 use namespace::autoclean;
12 shift->_apply_class_attributes(@_);
15 sub _apply_class_attributes {
20 my $class = Moose::Util::MetaRole::apply_metaclass_roles(
23 class => ['MooseX::ClassAttribute::Trait::Class'],
27 my $attr_metaclass = $class->attribute_metaclass();
29 foreach my $attribute_name ( $role->get_class_attribute_list() ) {
30 if ( $class->has_class_attribute($attribute_name)
31 && $class->get_class_attribute($attribute_name)
32 != $role->get_class_attribute($attribute_name) ) {
36 $class->add_class_attribute(
37 $role->get_class_attribute($attribute_name)
38 ->attribute_for_class($attr_metaclass) );
51 MooseX::ClassAttribute::Trait::Application::ToClass - A trait that supports applying class attributes to instances
55 This trait is used to allow the application of roles containing class
56 attributes to object instances.
60 Dave Rolsky, C<< <autarch@urth.org> >>
64 See L<MooseX::ClassAttribute> for details.
66 =head1 COPYRIGHT & LICENSE
68 Copyright 2007-2008 Dave Rolsky, All Rights Reserved.
70 This program is free software; you can redistribute it and/or modify
71 it under the same terms as Perl itself.