Revision history for Perl extension Class-MOP.
+ * Class::MOP::Class
+ - optimise metaclass-already-exists check in construct_class_instance
+ - duplicate check into initialize to save a call through
+
0.43
* Class::MOP::Method::Accessor
- made this a subclass of Class::MOP::Method::Generated
my $package_name = shift;
(defined $package_name && $package_name && !blessed($package_name))
|| confess "You must pass a package name and it cannot be blessed";
+ if (defined(my $meta = Class::MOP::get_metaclass_by_name($package_name))) {
+ return $meta;
+ }
$class->construct_class_instance('package' => $package_name, @_);
}
# and it is still defined (it has not been
# reaped by DESTROY yet, which can happen
# annoyingly enough during global destruction)
- return Class::MOP::get_metaclass_by_name($package_name)
- if Class::MOP::does_metaclass_exist($package_name);
+
+ if (defined(my $meta = Class::MOP::get_metaclass_by_name($package_name))) {
+ return $meta;
+ }
# NOTE:
# we need to deal with the possibility