Merge branch 'master' into renames-and-deprecations
[gitmo/Class-MOP.git] / lib / Class / MOP / Class.pm
index 53e39cd..ef1d1a1 100644 (file)
@@ -35,7 +35,13 @@ sub initialize {
         || 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";
+    shift->_construct_class_instance;
 }
 
 # NOTE: (meta-circularity)
@@ -44,7 +50,7 @@ sub initialize {
 # 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};
@@ -84,7 +90,7 @@ sub construct_class_instance {
     }
 
     # and check the metaclass compatibility
-    $meta->check_metaclass_compatibility();  
+    $meta->_check_metaclass_compatibility();  
 
     Class::MOP::store_metaclass_by_name($package_name, $meta);
 
@@ -146,7 +152,14 @@ sub update_package_cache_flag {
     $self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);    
 }
 
+
 sub check_metaclass_compatibility {
+    warn 'The check_metaclass_compatibility method has been made private.'
+        . " The public version is deprecated and will be removed in a future release.\n";
+    shift->_check_metaclass_compatibility;
+}
+
+sub _check_metaclass_compatibility {
     my $self = shift;
 
     # this is always okay ...
@@ -263,8 +276,6 @@ sub create {
         || confess "You must pass a HASH ref of methods"
             if exists $options{methods};                  
 
-    $class->SUPER::create(%options);
-
     my (%initialize_options) = @args;
     delete @initialize_options{qw(
         package
@@ -276,6 +287,8 @@ sub create {
     )};
     my $meta = $class->initialize( $package_name => %initialize_options );
 
+    $meta->_instantiate_module( $options{version}, $options{authority} );
+
     # FIXME totally lame
     $meta->add_method('meta' => sub {
         $class->initialize(ref($_[0]) || $_[0]);
@@ -323,7 +336,7 @@ sub new_object {
     # 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(@_);
 }
@@ -354,10 +367,16 @@ sub construct_instance {
 
 sub get_meta_instance {
     my $self = shift;
-    $self->{'_meta_instance'} ||= $self->create_meta_instance();
+    $self->{'_meta_instance'} ||= $self->_create_meta_instance();
 }
 
 sub create_meta_instance {
+    warn 'The create_meta_instance method has been made private.'
+        . " The public version is deprecated and will be removed in a future release.\n";
+    shift->_create_meta_instance;
+}
+
+sub _create_meta_instance {
     my $self = shift;
     
     my $instance = $self->instance_metaclass->new(
@@ -382,10 +401,16 @@ sub clone_object {
     # Class::MOP::Class singletons here, they
     # should not be cloned.
     return $instance if $instance->isa('Class::MOP::Class');
-    $class->clone_instance($instance, @_);
+    $class->_clone_instance($instance, @_);
 }
 
 sub clone_instance {
+    warn 'The clone_instance method has been made private.'
+        . " The public version is deprecated and will be removed in a future release.\n";
+    shift->_clone_instance;
+}
+
+sub _clone_instance {
     my ($class, $instance, %params) = @_;
     (blessed($instance))
         || confess "You can only clone instances, ($instance) is not a blessed instance";
@@ -471,7 +496,7 @@ sub superclasses {
         # not potentially creating an issues
         # we don't know about
 
-        $self->check_metaclass_compatibility();
+        $self->_check_metaclass_compatibility();
         $self->update_meta_instance_dependencies();
     }
     @{$self->get_package_symbol($var_spec)};
@@ -685,9 +710,9 @@ sub add_method {
 }
 
 sub alias_method {
-    my $self = shift;
+    warn "The alias_method method is deprecated. Use add_method instead.\n";
 
-    $self->add_method(@_);
+    shift->add_method;
 }
 
 sub has_method {
@@ -748,8 +773,10 @@ sub get_all_methods {
     return values %methods;
 }
 
-# compatibility
 sub compute_all_applicable_methods {
+    warn 'The compute_all_applicable_methods method is deprecated.'
+        . " Use get_all_methods instead.\n";
+
     return map {
         {
             name  => $_->name,