From: Dave Rolsky Date: Mon, 14 Mar 2011 19:27:46 +0000 (-0500) Subject: Prep for removing deprecated features or making them throw an error. X-Git-Tag: 1.9905~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=14bda29327e955a043700489d603b1718986d41d;p=gitmo%2FMoose.git Prep for removing deprecated features or making them throw an error. I changed the relevant deprecation warnings to mention what will happen in Moose 2.0200. I also updated Moose::Manual::Delta to list what will appen in 2.0200. --- diff --git a/lib/Class/MOP/Deprecated.pm b/lib/Class/MOP/Deprecated.pm index 37d1f1f..e033550 100644 --- a/lib/Class/MOP/Deprecated.pm +++ b/lib/Class/MOP/Deprecated.pm @@ -50,21 +50,21 @@ package sub HAVE_ISAREV () { Class::MOP::Deprecated::deprecated( - "Class::MOP::HAVE_ISAREV is deprecated and will be removed in a future release. It has always returned 1 anyway." + "Class::MOP::HAVE_ISAREV is deprecated and will be removed in a future release. It has always returned 1 anyway. This function will be removed in the Moose 2.0200 release." ); return 1; } sub subname { Class::MOP::Deprecated::deprecated( - "Class::MOP::subname is deprecated. Please use Sub::Name directly."); + "Class::MOP::subname is deprecated. Please use Sub::Name directly. This function will be removed in the Moose 2.0200 release."); require Sub::Name; goto \&Sub::Name::subname; } sub in_global_destruction { Class::MOP::Deprecated::deprecated( - "Class::MOP::in_global_destruction is deprecated. Please use Devel::GlobalDestruction directly." + "Class::MOP::in_global_destruction is deprecated. Please use Devel::GlobalDestruction directly. This function will be removed in the Moose 2.0200 release." ); require Devel::GlobalDestruction; goto \&Devel::GlobalDestruction::in_global_destruction; @@ -78,7 +78,7 @@ use Scalar::Util qw( blessed ); sub get_method_map { Class::MOP::Deprecated::deprecated( 'The get_method_map method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); my $self = shift; @@ -94,7 +94,7 @@ package sub construct_class_instance { Class::MOP::Deprecated::deprecated( 'The construct_class_instance method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_construct_class_instance(@_); } @@ -102,7 +102,7 @@ sub construct_class_instance { sub check_metaclass_compatibility { Class::MOP::Deprecated::deprecated( 'The check_metaclass_compatibility method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_check_metaclass_compatibility(@_); } @@ -110,7 +110,7 @@ sub check_metaclass_compatibility { sub construct_instance { Class::MOP::Deprecated::deprecated( 'The construct_instance method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_construct_instance(@_); } @@ -118,7 +118,7 @@ sub construct_instance { sub create_meta_instance { Class::MOP::Deprecated::deprecated( 'The create_meta_instance method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_create_meta_instance(@_); } @@ -126,14 +126,14 @@ sub create_meta_instance { sub clone_instance { Class::MOP::Deprecated::deprecated( 'The clone_instance method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_clone_instance(@_); } sub alias_method { Class::MOP::Deprecated::deprecated( - "The alias_method method is deprecated. Use add_method instead.\n"); + 'The alias_method method is deprecated. Use add_method instead. This method will be removed in the Moose 2.0200 release.'); shift->add_method(@_); } @@ -141,7 +141,7 @@ sub alias_method { sub compute_all_applicable_methods { Class::MOP::Deprecated::deprecated( 'The compute_all_applicable_methods method is deprecated.' - . " Use get_all_methods instead.\n" ); + . ' Use get_all_methods instead. This method will be removed in the Moose 2.0200 release.' ); return map { { @@ -155,14 +155,14 @@ sub compute_all_applicable_methods { sub compute_all_applicable_attributes { Class::MOP::Deprecated::deprecated( 'The compute_all_applicable_attributes method has been deprecated.' - . " Use get_all_attributes instead.\n" ); + . ' Use get_all_attributes instead. This method will be removed in the Moose 2.0200 release.' ); shift->get_all_attributes(@_); } sub get_attribute_map { Class::MOP::Deprecated::deprecated( - "The get_attribute_map method has been deprecated.\n"); + 'The get_attribute_map method has been deprecated. This method will be removed in the Moose 2.0200 release.'); shift->_attribute_map(@_); } @@ -173,7 +173,7 @@ package sub bless_instance_structure { Class::MOP::Deprecated::deprecated( 'The bless_instance_structure method is deprecated.' - . " It will be removed in a future release.\n" ); + . ' This method will be removed in the Moose 2.0200 release.' ); my ( $self, $instance_structure ) = @_; bless $instance_structure, $self->_class_name; @@ -185,7 +185,7 @@ package sub process_accessors { Class::MOP::Deprecated::deprecated( 'The process_accessors method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_process_accessors(@_); } @@ -196,7 +196,7 @@ package sub initialize_body { Class::MOP::Deprecated::deprecated( 'The initialize_body method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_initialize_body; } @@ -204,7 +204,7 @@ sub initialize_body { sub generate_accessor_method { Class::MOP::Deprecated::deprecated( 'The generate_accessor_method method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_accessor_method; } @@ -212,7 +212,7 @@ sub generate_accessor_method { sub generate_reader_method { Class::MOP::Deprecated::deprecated( 'The generate_reader_method method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_reader_method; } @@ -220,7 +220,7 @@ sub generate_reader_method { sub generate_writer_method { Class::MOP::Deprecated::deprecated( 'The generate_writer_method method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_writer_method; } @@ -228,7 +228,7 @@ sub generate_writer_method { sub generate_predicate_method { Class::MOP::Deprecated::deprecated( 'The generate_predicate_method method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_predicate_method; } @@ -236,7 +236,7 @@ sub generate_predicate_method { sub generate_clearer_method { Class::MOP::Deprecated::deprecated( 'The generate_clearer_method method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_clearer_method; } @@ -244,7 +244,7 @@ sub generate_clearer_method { sub generate_accessor_method_inline { Class::MOP::Deprecated::deprecated( 'The generate_accessor_method_inline method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_accessor_method_inline; } @@ -252,7 +252,7 @@ sub generate_accessor_method_inline { sub generate_reader_method_inline { Class::MOP::Deprecated::deprecated( 'The generate_reader_method_inline method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_reader_method_inline; } @@ -260,7 +260,7 @@ sub generate_reader_method_inline { sub generate_writer_method_inline { Class::MOP::Deprecated::deprecated( 'The generate_writer_method_inline method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_writer_method_inline; } @@ -268,7 +268,7 @@ sub generate_writer_method_inline { sub generate_predicate_method_inline { Class::MOP::Deprecated::deprecated( 'The generate_predicate_method_inline method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_predicate_method_inline; } @@ -276,7 +276,7 @@ sub generate_predicate_method_inline { sub generate_clearer_method_inline { Class::MOP::Deprecated::deprecated( 'The generate_clearer_method_inline method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_clearer_method_inline; } @@ -287,7 +287,7 @@ package sub meta_instance { Class::MOP::Deprecated::deprecated( 'The meta_instance method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_meta_instance; } @@ -295,7 +295,7 @@ sub meta_instance { sub attributes { Class::MOP::Deprecated::deprecated( 'The attributes method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); return shift->_attributes; @@ -304,7 +304,7 @@ sub attributes { sub initialize_body { Class::MOP::Deprecated::deprecated( 'The initialize_body method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_initialize_body; } @@ -312,7 +312,7 @@ sub initialize_body { sub generate_constructor_method { Class::MOP::Deprecated::deprecated( 'The generate_constructor_method method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_constructor_method; } @@ -320,7 +320,7 @@ sub generate_constructor_method { sub generate_constructor_method_inline { Class::MOP::Deprecated::deprecated( 'The generate_constructor_method_inline method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n" + . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' ); shift->_generate_constructor_method_inline; } diff --git a/lib/Moose.pm b/lib/Moose.pm index df6f68c..ec39490 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -132,7 +132,8 @@ sub init_meta { if ( $_[0] ne __PACKAGE__ ) { Moose::Deprecated::deprecated( feature => 'Moose::init_meta', - message => 'Calling Moose::init_meta as a function is deprecated', + message => 'Calling Moose::init_meta as a function is deprecated.' + . ' Doing so will throw an error in Moose 2.0200.' ); return __PACKAGE__->init_meta( diff --git a/lib/Moose/Manual/Delta.pod b/lib/Moose/Manual/Delta.pod index 7ecb2f1..e9d42e9 100644 --- a/lib/Moose/Manual/Delta.pod +++ b/lib/Moose/Manual/Delta.pod @@ -44,6 +44,64 @@ C option, as in: }, ); +=item Most deprecated APIs/features are slated for removal in Moose 2.0200 + +Most of the deprecated APIs and features in Moose will start throwing an error +in Moose 2.0200. Some of the features will go away entirely, and some will +simply throw an error. + +The things on the chopping block are: + +=over 8 + +=item * Old public methods in Class::MOP and Moose + +This includes things like C<< Class::MOP::Class->get_attribute_map >>, C<< +Class::MOP::Class->construct_instance >>, and many others. These were +deprecated in L 0.80_01, release on April 5, 2009. + +These methods will be removed entirely in Moose 2.0200. + +=item * Old public functions in Class::MOP + +This include C, C, and +the C constant. The first two were deprecated in 0.84, +and the last in 0.80. Class::MOP 0.84 was released on May 12, 2009. + +These functions will be removed entirely in Moose 2.0200. + +=item * The C and C option for role composition + +These were renamed to C<-alias> and C<-excludes> in Moose 0.89, released on +August 13, 2009. + +Passing these will throw an error in Moose 2.0200. + +=item * The old L API + +This include the C function, as well as passing the +C or any key ending in C<_roles> to C. This was +deprecated in Moose 0.93_01, released on January 4, 2010. + +These will all throw an error in Moose 2.0200. + +=item * Passing plain lists to C or C + +The old API for these functions allowed you to pass a plain list of parameter, +rather than a list of hash references (which is what C, C, +etc. return). This was deprecated in Moose 0.71_01, released on February 22, +2009. + +This will throw an error in Moose 2.0200. + +=item * The Role subtype + +This subtype was deprecated in Moose 0.84, released on June 26, 2009. + +This will be removed entirely in Moose 2.0200. + +=back + =back =head1 1.16 diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index c9257b0..f503d5a 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -467,7 +467,8 @@ sub apply { 'The alias and excludes options for role application'. ' have been renamed -alias and -excludes'. " (${\$other->name} is consuming ${\$self->name}". - " - do you need to upgrade ${\$other->name}?)" + " - do you need to upgrade ${\$other->name}?).". + ' This will be an error in Moose 2.0200.' ); } diff --git a/lib/Moose/Util/MetaRole.pm b/lib/Moose/Util/MetaRole.pm index 149be85..ed8e0cc 100644 --- a/lib/Moose/Util/MetaRole.pm +++ b/lib/Moose/Util/MetaRole.pm @@ -12,7 +12,8 @@ sub apply_metaclass_roles { Moose::Deprecated::deprecated( feature => 'pre-0.94 MetaRole API', message => - 'The old Moose::Util::MetaRole API (before version 0.94) has been deprecated' + 'The old Moose::Util::MetaRole API (before version 0.94) has been deprecated.' + . ' Using this API will throw an error in Moose 2.0200.' ); goto &apply_metaroles; @@ -44,7 +45,8 @@ sub _fixup_old_style_args { Moose::Deprecated::deprecated( feature => 'pre-0.94 MetaRole API', message => - 'The old Moose::Util::MetaRole API (before version 0.94) has been deprecated' + 'The old Moose::Util::MetaRole API (before version 0.94) has been deprecated.' + . ' Using this API will throw an error in Moose 2.0200.' ); $args->{for} = delete $args->{for_class} diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index 71b32d7..d20fbf2 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -275,7 +275,7 @@ sub type { Moose::Deprecated::deprecated( feature => 'type without sugar', message => - 'Calling type() with a simple list of parameters is deprecated' + 'Calling type() with a simple list of parameters is deprecated. This will be an error in Moose 2.0200.' ); return _create_type_constraint( $_[0], undef, $_[1] ); @@ -300,7 +300,7 @@ sub subtype { Moose::Deprecated::deprecated( feature => 'subtype without sugar', message => - 'Calling subtype() with a simple list of parameters is deprecated' + 'Calling subtype() with a simple list of parameters is deprecated. This will be an error in Moose 2.0200.' ); return _create_type_constraint( undef, @_ ); @@ -313,7 +313,7 @@ sub subtype { Moose::Deprecated::deprecated( feature => 'subtype without sugar', message => - 'Calling subtype() with a simple list of parameters is deprecated' + 'Calling subtype() with a simple list of parameters is deprecated. This will be an error in Moose 2.0200.' ); return _create_type_constraint( undef, @_ ); @@ -324,7 +324,7 @@ sub subtype { Moose::Deprecated::deprecated( feature => 'subtype without sugar', message => - 'Calling subtype() with a simple list of parameters is deprecated' + 'Calling subtype() with a simple list of parameters is deprecated. This will be an error in Moose 2.0200.' ); return _create_type_constraint(@_); diff --git a/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm b/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm index 9365a8c..b13d8ac 100644 --- a/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm +++ b/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm @@ -43,7 +43,7 @@ sub Role { Moose::Deprecated::deprecated( feature => 'Role type', message => - 'The Role type has been deprecated. Maybe you meant to create a RoleName type?' + 'The Role type has been deprecated. Maybe you meant to create a RoleName type? This type be will be removed in Moose 2.0200.' ); blessed( $_[0] ) && $_[0]->can('does'); }