optimized RoleName class_of
Shawn M Moore [Sat, 28 Mar 2009 21:41:59 +0000 (17:41 -0400)]
lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm

index 7999895..a8f2510 100644 (file)
@@ -38,8 +38,8 @@ sub ClassName {
 }
 
 sub RoleName {
-    ClassName($_[0]) 
-        && (($_[0]->can('meta') || return)->($_[0]) || return)->isa('Moose::Meta::Role')
+    ClassName($_[0])
+    && (Class::MOP::class_of($_[0]) || return)->isa('Moose::Meta::Role')
 }
 
 # NOTE: