From: Dave Rolsky Date: Wed, 2 Sep 2009 15:28:24 +0000 (-0500) Subject: more work on ignoring meta in role method list X-Git-Tag: 0.90~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a8547bc066e8fc1ca088f63843b2f8afbea88321;p=gitmo%2FMoose.git more work on ignoring meta in role method list --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index c31f3c8..9022f17 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -687,10 +687,11 @@ sub _canonicalize_handles { (blessed $role_meta && $role_meta->isa('Moose::Meta::Role')) || $self->throw_error("Unable to canonicalize the 'handles' option with $handles because its metaclass is not a Moose::Meta::Role", data => $handles); - return map { $_ => $_ } ( + return map { $_ => $_ } + grep { $_ ne 'meta' } ( $role_meta->get_method_list, map { $_->name } $role_meta->get_required_method_list, - ); + ); } } diff --git a/lib/Moose/Meta/Role/Application/RoleSummation.pm b/lib/Moose/Meta/Role/Application/RoleSummation.pm index b9777eb..f2b91d3 100644 --- a/lib/Moose/Meta/Role/Application/RoleSummation.pm +++ b/lib/Moose/Meta/Role/Application/RoleSummation.pm @@ -150,6 +150,7 @@ 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{$_} ? () : diff --git a/t/030_roles/002_role.t b/t/030_roles/002_role.t index 70c31a2..3e0f99f 100644 --- a/t/030_roles/002_role.t +++ b/t/030_roles/002_role.t @@ -66,7 +66,7 @@ isa_ok($foo_role->get_method('boo'), 'Moose::Meta::Role::Method'); is_deeply( [ sort $foo_role->get_method_list() ], - [ 'boo', 'foo' ], + [ 'boo', 'foo', 'meta' ], '... got the right method list'); ok(FooRole->can('foo'), "locally defined methods are still there");