don't check class_precedence_list in does, since does_role already does
Jesse Luehrs [Thu, 21 Jan 2010 08:23:05 +0000 (02:23 -0600)]
Changes
lib/Moose/Object.pm

diff --git a/Changes b/Changes
index 1576ad8..20bd23c 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,11 @@
 Also see Moose::Manual::Delta for more details of, and workarounds
 for, noteworthy changes.
 
+  [ENHANCEMENTS]
+
+  * Moose::Object::does no longer checks the entire inheritance tree, since
+    Moose::Meta::Class::does_role already does this. (doy)
+
 0.94 Mon, Jan 18, 2010
 
   [API CHANGES]
index 4779eed..1cd1f6a 100644 (file)
@@ -119,11 +119,7 @@ sub does {
     my $meta = Class::MOP::class_of($self);
     (defined $role_name)
         || $meta->throw_error("You must supply a role name to does()");
-    foreach my $class ($meta->class_precedence_list) {
-        my $m = $meta->initialize($class);
-        return 1
-            if $m->can('does_role') && $m->does_role($role_name);
-    }
+    return 1 if $meta->can('does_role') && $meta->does_role($role_name);
     return 0;
 }