From: Dave Rolsky Date: Mon, 16 Mar 2009 16:09:41 +0000 (-0500) Subject: make CMOP::Class->clone_instance private X-Git-Tag: 0.80_01~50 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d379f5520acc9526a77f184a929d8a06add2184a;p=gitmo%2FClass-MOP.git make CMOP::Class->clone_instance private --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index db8b831..883d5fb 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -402,10 +402,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"; + goto &_clone_instance; +} + +sub _clone_instance { my ($class, $instance, %params) = @_; (blessed($instance)) || confess "You can only clone instances, ($instance) is not a blessed instance"; diff --git a/t/010_self_introspection.t b/t/010_self_introspection.t index ef2412a..5ccb59f 100644 --- a/t/010_self_introspection.t +++ b/t/010_self_introspection.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 250; +use Test::More tests => 252; use Test::Exception; use Class::MOP; @@ -60,7 +60,7 @@ my @class_mop_class_methods = qw( new_object clone_object construct_instance construct_class_instance _construct_class_instance - clone_instance + clone_instance _clone_instance rebless_instance check_metaclass_compatibility _check_metaclass_compatibility diff --git a/t/016_class_errors_and_edge_cases.t b/t/016_class_errors_and_edge_cases.t index 1626e0e..7c3b684 100644 --- a/t/016_class_errors_and_edge_cases.t +++ b/t/016_class_errors_and_edge_cases.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 48; +use Test::More tests => 47; use Test::Exception; use Class::MOP; @@ -58,10 +58,6 @@ use Class::MOP; dies_ok { Class::MOP::Class->clone_object(1); } '... can only clone instances'; - - dies_ok { - Class::MOP::Class->clone_instance(1); - } '... can only clone instances'; } {