From: Shawn M Moore Date: Sat, 28 Mar 2009 20:49:43 +0000 (-0400) Subject: Look up the metaclass in get_method_map instead of blindly calling meta X-Git-Tag: 0.73_01~36^2~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e55d4727fa8c75821d64420d327ebdb8e5980631;p=gitmo%2FMoose.git Look up the metaclass in get_method_map instead of blindly calling meta on foreign packages! Yikes! --- diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 05e4c05..a6ff920 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -323,18 +323,10 @@ sub get_method_map { $map->{$symbol}->body == $code; my ($pkg, $name) = Class::MOP::get_code_info($code); + my $meta = Class::MOP::class_of($pkg); - if ($pkg->can('meta') - # NOTE: - # we don't know what ->meta we are calling - # here, so we need to be careful cause it - # just might blow up at us, or just complain - # loudly (in the case of Curses.pm) so we - # just be a little overly cautious here. - # - SL - && eval { no warnings; blessed($pkg->meta) } # FIXME calls meta - && $pkg->meta->isa('Moose::Meta::Role')) { - my $role = $pkg->meta->name; + if ($meta && $meta->isa('Moose::Meta::Role')) { + my $role = $meta->name; next unless $self->does_role($role); } else {