X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FClassAttribute%2FTrait%2FApplication%2FToClass.pm;h=365813d84ae44840915322aa7957e644b101fbbf;hb=3e9e5aef1aa4a05b64d7beddc49121775bec5320;hp=91c474577a14f6b2dbbc4f589d72bffdaf51f365;hpb=f77be1270c08f6fce772bb7c26f3a8eaf37c5b9a;p=gitmo%2FMooseX-ClassAttribute.git diff --git a/lib/MooseX/ClassAttribute/Trait/Application/ToClass.pm b/lib/MooseX/ClassAttribute/Trait/Application/ToClass.pm index 91c4745..365813d 100644 --- a/lib/MooseX/ClassAttribute/Trait/Application/ToClass.pm +++ b/lib/MooseX/ClassAttribute/Trait/Application/ToClass.pm @@ -3,25 +3,32 @@ package MooseX::ClassAttribute::Trait::Application::ToClass; use strict; use warnings; -our $VERSION = '0.10'; - use namespace::autoclean; use Moose::Role; with 'MooseX::ClassAttribute::Trait::Application'; -sub _apply_class_attributes { +around apply => sub { + my $orig = shift; my $self = shift; my $role = shift; my $class = shift; - $class = Moose::Util::MetaRole::apply_metaclass_roles( + $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() ) { @@ -40,32 +47,19 @@ sub _apply_class_attributes { 1; +# ABSTRACT: A trait that supports applying class attributes to classes + __END__ =pod -=head1 NAME - -MooseX::ClassAttribute::Trait::Application::ToClass - A trait that supports applying class attributes to classes - =head1 DESCRIPTION This trait is used to allow the application of roles containing class attributes to classes. -=head1 AUTHOR - -Dave Rolsky, C<< >> - =head1 BUGS See L for details. -=head1 COPYRIGHT & LICENSE - -Copyright 2007-2008 Dave Rolsky, All Rights Reserved. - -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. - =cut