From: Dave Rolsky Date: Fri, 22 May 2009 03:52:46 +0000 (-0500) Subject: use CMOP::class_of instead of CMOP::Class->initialize X-Git-Tag: 0.09~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=941ae03a6c2f4e7e594a66f8aaa08b8a2cad55b7;p=gitmo%2FMooseX-ClassAttribute.git use CMOP::class_of instead of CMOP::Class->initialize --- diff --git a/lib/MooseX/ClassAttribute.pm b/lib/MooseX/ClassAttribute.pm index c2f37c5..06580ac 100644 --- a/lib/MooseX/ClassAttribute.pm +++ b/lib/MooseX/ClassAttribute.pm @@ -36,8 +36,7 @@ sub class_has my $attrs = ref $name eq 'ARRAY' ? $name : [$name]; - Class::MOP::Class - ->initialize($caller) + Class::MOP::class_of($caller) ->add_class_attribute( $_, %options ) for @{ $attrs }; } diff --git a/lib/MooseX/ClassAttribute/Role/Meta/Class.pm b/lib/MooseX/ClassAttribute/Role/Meta/Class.pm index 1afe8c7..eb798a3 100644 --- a/lib/MooseX/ClassAttribute/Role/Meta/Class.pm +++ b/lib/MooseX/ClassAttribute/Role/Meta/Class.pm @@ -144,8 +144,8 @@ sub get_all_class_attributes my $self = shift; my %attrs = - map { my $meta = Class::MOP::Class->initialize($_); - $meta->can('get_class_attribute_map') + map { my $meta = Class::MOP::class_of($_); + $meta && $meta->can('get_class_attribute_map') ? %{ $meta->get_class_attribute_map() } : () } @@ -169,7 +169,8 @@ sub find_class_attribute_by_name foreach my $class ( $self->linearized_isa() ) { - my $meta = Class::MOP::Class->initialize($class); + my $meta = Class::MOP::class_of($class) + or next; return $meta->get_class_attribute($name) if $meta->can('has_class_attribute') && $meta->has_class_attribute($name);