From: Jesse Luehrs Date: Fri, 24 Sep 2010 01:25:22 +0000 (-0500) Subject: stop testing for methods named 'meta' X-Git-Tag: 1.15~33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba7d613dcaaf238ed484c40bf70facfe6173ea95;p=gitmo%2FMoose.git stop testing for methods named 'meta' --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index aebca6f..4da588f 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -685,9 +685,10 @@ sub _canonicalize_handles { || $self->throw_error("Unable to canonicalize the 'handles' option with $handles because its metaclass is not a Moose::Meta::Role", data => $handles); return map { $_ => $_ } - grep { $_ ne 'meta' } ( - $role_meta->get_method_list, - map { $_->name } $role_meta->get_required_method_list, + map { $_->name } + grep { !$_->isa('Class::MOP::Method::Meta') } ( + $role_meta->_get_local_methods, + $role_meta->get_required_method_list, ); } @@ -712,7 +713,7 @@ sub _get_delegate_method_list { my $meta = $self->_find_delegate_metaclass; if ($meta->isa('Class::MOP::Class')) { return map { $_->name } # NOTE: !never! delegate &meta - grep { $_->package_name ne 'Moose::Object' && $_->name ne 'meta' } + grep { $_->package_name ne 'Moose::Object' && !$_->isa('Class::MOP::Method::Meta') } $meta->get_all_methods; } elsif ($meta->isa('Moose::Meta::Role')) { diff --git a/lib/Moose/Meta/Role/Application/RoleSummation.pm b/lib/Moose/Meta/Role/Application/RoleSummation.pm index 26b88ca..9a07857 100644 --- a/lib/Moose/Meta/Role/Application/RoleSummation.pm +++ b/lib/Moose/Meta/Role/Application/RoleSummation.pm @@ -156,7 +156,6 @@ sub apply_methods { my $role = $_; my $aliases = $self->get_method_aliases_for_role($role); my %excludes = map { $_ => undef } @{ $self->get_exclusions_for_role($role) }; - $excludes{meta} = undef; ( (map { exists $excludes{$_} ? () : @@ -165,7 +164,9 @@ sub apply_methods { name => $_, method => $role->get_method($_), } - } $role->get_method_list), + } map { $_->name } + grep { !$_->isa('Class::MOP::Method::Meta') } + $role->_get_local_methods), (map { +{ role => $role, diff --git a/lib/Moose/Meta/Role/Application/ToClass.pm b/lib/Moose/Meta/Role/Application/ToClass.pm index a763535..584a30c 100644 --- a/lib/Moose/Meta/Role/Application/ToClass.pm +++ b/lib/Moose/Meta/Role/Application/ToClass.pm @@ -152,7 +152,7 @@ sub apply_methods { foreach my $method ( $role->_get_local_methods ) { my $method_name = $method->name; - next if $method_name eq 'meta'; + next if $method->isa('Class::MOP::Method::Meta'); unless ( $self->is_method_excluded($method_name) ) { diff --git a/lib/Moose/Meta/Role/Application/ToRole.pm b/lib/Moose/Meta/Role/Application/ToRole.pm index 23c634c..4d37194 100644 --- a/lib/Moose/Meta/Role/Application/ToRole.pm +++ b/lib/Moose/Meta/Role/Application/ToRole.pm @@ -81,7 +81,7 @@ sub apply_methods { my $method_name = $method->name; - next if $method_name eq 'meta'; + next if $method->isa('Class::MOP::Method::Meta'); unless ( $self->is_method_excluded($method_name) ) { diff --git a/lib/Moose/Util.pm b/lib/Moose/Util.pm index 2ccb608..57404bf 100644 --- a/lib/Moose/Util.pm +++ b/lib/Moose/Util.pm @@ -408,7 +408,7 @@ sub _is_role_only_subclass { # (not inherited) for my $method ( $meta->_get_local_methods ) { # always ignore meta - next if $method->name eq 'meta'; + next if $method->isa('Class::MOP::Method::Meta'); # we'll deal with attributes below next if $method->can('associated_attribute'); # if the method comes from a role we consumed, ignore it