From: Shawn M Moore Date: Sat, 28 Mar 2009 19:26:15 +0000 (-0400) Subject: Class::MOP::class_of($instance_or_class) X-Git-Tag: 0.80~24 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=53e908736ce4525f484da15637d259695353d604;p=gitmo%2FClass-MOP.git Class::MOP::class_of($instance_or_class) --- diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index 399976c..54ee7f4 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -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 ... ## ----------------------------------------------------------------------------