From: Dave Rolsky Date: Thu, 19 Mar 2009 18:40:22 +0000 (-0500) Subject: Using goto is very subclass-unfriendly, and breaks Moose for no reason. X-Git-Tag: 0.80_01~16 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d5c7f6383f166b200022c925d184d062ca38b054;p=gitmo%2FClass-MOP.git Using goto is very subclass-unfriendly, and breaks Moose for no reason. --- diff --git a/lib/Class/MOP/Attribute.pm b/lib/Class/MOP/Attribute.pm index bd69def..7375bb9 100644 --- a/lib/Class/MOP/Attribute.pm +++ b/lib/Class/MOP/Attribute.pm @@ -331,7 +331,7 @@ sub accessor_metaclass { 'Class::MOP::Method::Accessor' } sub process_accessors { warn 'The process_accessors method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_process_accessors; + shift->_process_accessors; } sub _process_accessors { diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 86bf701..97f7517 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -41,7 +41,7 @@ sub initialize { 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; + shift->_construct_class_instance; } # NOTE: (meta-circularity) @@ -157,7 +157,7 @@ sub update_package_cache_flag { 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"; - goto &_check_metaclass_compatibility; + shift->_check_metaclass_compatibility; } sub _check_metaclass_compatibility { @@ -374,7 +374,7 @@ sub get_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"; - goto &_create_meta_instance; + shift->_create_meta_instance; } sub _create_meta_instance { @@ -408,7 +408,7 @@ sub clone_object { 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; + shift->_clone_instance; } sub _clone_instance { @@ -707,7 +707,7 @@ sub add_method { sub alias_method { warn "The alias_method method is deprecated. Use add_method instead.\n"; - goto &add_method; + shift->add_method; } sub has_method { diff --git a/lib/Class/MOP/Method/Accessor.pm b/lib/Class/MOP/Method/Accessor.pm index e17bb11..4df2cf1 100644 --- a/lib/Class/MOP/Method/Accessor.pm +++ b/lib/Class/MOP/Method/Accessor.pm @@ -60,7 +60,7 @@ sub accessor_type { (shift)->{'accessor_type'} } sub initialize_body { warn 'The initialize_body method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_initialize_body; + shift->_initialize_body; } sub _initialize_body { @@ -82,7 +82,7 @@ sub _initialize_body { sub generate_accessor_method { warn 'The generate_accessor_method method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_accessor_method; + shift->_generate_accessor_method; } sub _generate_accessor_method { @@ -96,7 +96,7 @@ sub _generate_accessor_method { sub generate_reader_method { warn 'The generate_reader_method method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_reader_method; + shift->_generate_reader_method; } sub _generate_reader_method { @@ -110,7 +110,7 @@ sub _generate_reader_method { sub generate_writer_method { warn 'The generate_writer_method method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_writer_method; + shift->_generate_writer_method; } sub _generate_writer_method { @@ -123,7 +123,7 @@ sub _generate_writer_method { sub generate_predicate_method { warn 'The generate_predicate_method method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_predicate_method; + shift->_generate_predicate_method; } sub _generate_predicate_method { @@ -136,7 +136,7 @@ sub _generate_predicate_method { sub generate_clearer_method { warn 'The generate_clearer_method method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_clearer_method; + shift->_generate_clearer_method; } sub _generate_clearer_method { @@ -151,7 +151,7 @@ sub _generate_clearer_method { sub generate_accessor_method_inline { warn 'The generate_accessor_method_inline method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_accessor_method_inline; + shift->_generate_accessor_method_inline; } sub _generate_accessor_method_inline { @@ -176,7 +176,7 @@ sub _generate_accessor_method_inline { sub generate_reader_method_inline { warn 'The generate_reader_method_inline method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_reader_method_inline; + shift->_generate_reader_method_inline; } sub _generate_reader_method_inline { @@ -200,7 +200,7 @@ sub _generate_reader_method_inline { sub generate_writer_method_inline { warn 'The generate_writer_method_inline method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_writer_method_inline; + shift->_generate_writer_method_inline; } sub _generate_writer_method_inline { @@ -223,7 +223,7 @@ sub _generate_writer_method_inline { sub generate_predicate_method_inline { warn 'The generate_predicate_method_inline method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_predicate_method_inline; + shift->_generate_predicate_method_inline; } sub _generate_predicate_method_inline { @@ -246,7 +246,7 @@ sub _generate_predicate_method_inline { sub generate_clearer_method_inline { warn 'The generate_clearer_method_inline method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_clearer_method_inline; + shift->_generate_clearer_method_inline; } sub _generate_clearer_method_inline { diff --git a/lib/Class/MOP/Method/Constructor.pm b/lib/Class/MOP/Method/Constructor.pm index ad02b8e..c4aadff 100644 --- a/lib/Class/MOP/Method/Constructor.pm +++ b/lib/Class/MOP/Method/Constructor.pm @@ -64,7 +64,7 @@ sub associated_metaclass { (shift)->{'associated_metaclass'} } sub meta_instance { warn 'The meta_instance method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_meta_instance; + shift->_meta_instance; } sub _meta_instance { @@ -85,7 +85,7 @@ sub attributes { sub initialize_body { warn 'The initialize_body method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_initialize_body; + shift->_initialize_body; } sub _initialize_body { @@ -100,7 +100,7 @@ sub _initialize_body { sub generate_constructor_method { warn 'The generate_constructor_method method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_constructor_method; + shift->_generate_constructor_method; } sub _generate_constructor_method { @@ -110,7 +110,7 @@ sub _generate_constructor_method { sub generate_constructor_method_inline { warn 'The generate_constructor_method_inline method has been made private.' . " The public version is deprecated and will be removed in a future release.\n"; - goto &_generate_constructor_method_inline; + shift->_generate_constructor_method_inline; } sub _generate_constructor_method_inline {