|| confess "You must pass a package name and it cannot be blessed";
return Class::MOP::get_metaclass_by_name($package_name)
- || $class->construct_class_instance(package => $package_name, @_);
+ || $class->_construct_class_instance(package => $package_name, @_);
+}
+
+sub construct_class_instance {
+ warn 'The construct_class_instance method has been made private.'
+ . " The public version is deprecated and will be removed in a future release.\n";
+ goto &_construct_class_instance;
}
# NOTE: (meta-circularity)
# meta-object instances for any Class::MOP::*
# class. All other classes will use the more
# normal &construct_instance.
-sub construct_class_instance {
+sub _construct_class_instance {
my $class = shift;
my $options = @_ == 1 ? $_[0] : {@_};
my $package_name = $options->{package};
# Class::MOP::Class singletons here, so we
# delegate this to &construct_class_instance
# which will deal with the singletons
- return $class->construct_class_instance(@_)
+ return $class->_construct_class_instance(@_)
if $class->name->isa('Class::MOP::Class');
return $class->construct_instance(@_);
}
use strict;
use warnings;
-use Test::More tests => 244;
+use Test::More tests => 246;
use Test::Exception;
use Class::MOP;
instance_metaclass get_meta_instance create_meta_instance
new_object clone_object
- construct_instance construct_class_instance clone_instance
+ construct_instance
+ construct_class_instance _construct_class_instance
+ clone_instance
rebless_instance
check_metaclass_compatibility
{
dies_ok {
- Class::MOP::Class->construct_class_instance();
- } '... construct_class_instance requires an :package parameter';
+ Class::MOP::Class->_construct_class_instance();
+ } '... _construct_class_instance requires an :package parameter';
dies_ok {
- Class::MOP::Class->construct_class_instance(':package' => undef);
- } '... construct_class_instance requires a defined :package parameter';
+ Class::MOP::Class->_construct_class_instance(':package' => undef);
+ } '... _construct_class_instance requires a defined :package parameter';
dies_ok {
- Class::MOP::Class->construct_class_instance(':package' => '');
- } '... construct_class_instance requires a valid :package parameter';
+ Class::MOP::Class->_construct_class_instance(':package' => '');
+ } '... _construct_class_instance requires a valid :package parameter';
}