sub does_metaclass_exist { exists $METAS{$_[0]} && defined $METAS{$_[0]} }
sub remove_metaclass_by_name { $METAS{$_[0]} = undef }
+ # This handles instances as well as class names
+ sub class_of {
+ my $class = blessed($_[0]) || $_[0];
+ return $METAS{$class};
+ }
+
# NOTE:
# We only cache metaclasses, meaning instances of
# Class::MOP::Class. We do not cache instance of
return 0;
}
-sub class_of {
- my $class = blessed($_[0]) || $_[0];
- return get_metaclass_by_name($class);
-}
-
## ----------------------------------------------------------------------------
## Setting up our environment ...
## ----------------------------------------------------------------------------