From: Jesse Luehrs Date: Mon, 27 Sep 2010 06:03:53 +0000 (-0500) Subject: be a bit more accurate in determining role-only subclasses X-Git-Tag: 1.15~44 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=94aa91e2c3ee229c6dc781cf8c5f4d1a423a190d;p=gitmo%2FMoose.git be a bit more accurate in determining role-only subclasses --- diff --git a/lib/Moose/Meta/Class.pm b/lib/Moose/Meta/Class.pm index ccb6538..801b39e 100644 --- a/lib/Moose/Meta/Class.pm +++ b/lib/Moose/Meta/Class.pm @@ -466,10 +466,15 @@ sub _is_role_only_subclass { my ($parent_name) = @parent_names; my $parent_meta = Class::MOP::Class->initialize($parent_name); - my @roles = $meta->can('calculate_all_roles_with_inheritance') - ? $meta->calculate_all_roles_with_inheritance + # only get the roles attached to this particular class, don't look at + # superclasses + my @roles = $meta->can('calculate_all_roles') + ? $meta->calculate_all_roles : (); + # it's obviously not a role-only subclass if it doesn't do any roles + return unless @roles; + # loop over all methods that are a part of the current class # (not inherited) for my $method ( $meta->_get_local_methods ) {