Class::MOP::class_of($instance_or_class)
Shawn M Moore [Sat, 28 Mar 2009 19:26:15 +0000 (15:26 -0400)]
lib/Class/MOP.pm

index 399976c..54ee7f4 100644 (file)
@@ -136,6 +136,15 @@ sub _is_valid_class_name {
     return 0;
 }
 
+sub class_of {
+    my $self  = shift;
+    my $class = shift;
+
+    $class = blessed($class) || $class;
+
+    return get_metaclass_by_name($class);
+}
+
 ## ----------------------------------------------------------------------------
 ## Setting up our environment ...
 ## ----------------------------------------------------------------------------