From: Jesse Luehrs Date: Sun, 19 Jun 2011 04:59:59 +0000 (-0500) Subject: remove old deprecated code X-Git-Tag: 2.0103~30 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=898733eb1f3e00977afe3539faae499cb41e550f;p=gitmo%2FMoose.git remove old deprecated code --- diff --git a/lib/Class/MOP/Deprecated.pm b/lib/Class/MOP/Deprecated.pm index e033550..35337e5 100644 --- a/lib/Class/MOP/Deprecated.pm +++ b/lib/Class/MOP/Deprecated.pm @@ -4,327 +4,32 @@ use strict; use warnings; use Package::DeprecationManager -deprecations => { - 'Class::MOP::HAVE_ISAREV' => '0.93', - 'Class::MOP::subname' => '0.93', - 'Class::MOP::in_global_destruction' => '0.93', - - 'Class::MOP::Package::get_method_map' => '0.93', - - 'Class::MOP::Class::construct_class_instance' => '0.93', - 'Class::MOP::Class::check_metaclass_compatibility' => '0.93', - 'Class::MOP::Class::create_meta_instance' => '0.93', - 'Class::MOP::Class::clone_instance' => '0.93', - 'Class::MOP::Class::alias_method' => '0.93', - 'Class::MOP::Class::compute_all_applicable_methods' => '0.93', - 'Class::MOP::Class::compute_all_applicable_attributes' => '0.93', - 'Class::MOP::Class::get_attribute_map' => '0.95', - - 'Class::MOP::Instance::bless_instance_structure' => '0.93', - - 'Class::MOP::Attribute::process_accessors' => '0.93', - - 'Class::MOP::Method::Accessor::initialize_body' => '0.93', - 'Class::MOP::Method::Accessor::generate_accessor_method' => '0.93', - 'Class::MOP::Method::Accessor::generate_reader_method' => '0.93', - 'Class::MOP::Method::Accessor::generate_writer_method' => '0.93', - 'Class::MOP::Method::Accessor::generate_predicate_method' => '0.93', - 'Class::MOP::Method::Accessor::generate_clearer_method' => '0.93', - 'Class::MOP::Method::Accessor::generate_accessor_method_inline' => '0.93', - 'Class::MOP::Method::Accessor::generate_reader_method_inline' => '0.93', - 'Class::MOP::Method::Accessor::generate_writer_method_inline' => '0.93', - 'Class::MOP::Method::Accessor::generate_clearer_method_inline' => '0.93', - 'Class::MOP::Method::Accessor::generate_predicate_method_inline' => - '0.93', - - 'Class::MOP::Method::Constructor::meta_instance' => '0.93', - 'Class::MOP::Method::Constructor::attributes' => '0.93', - 'Class::MOP::Method::Constructor::initialize_body' => '0.93', - 'Class::MOP::Method::Constructor::generate_constructor_method' => '0.93', - 'Class::MOP::Method::Constructor::generate_constructor_method_inline' => - '0.93', }; - package Class::MOP; -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. 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. 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. This function will be removed in the Moose 2.0200 release." - ); - require Devel::GlobalDestruction; - goto \&Devel::GlobalDestruction::in_global_destruction; -} - package Class::MOP::Package; -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. This method will be removed in the Moose 2.0200 release.' - ); - my $self = shift; - - return { map { $_->name => $_ } $self->_get_local_methods }; -} - package Class::MOP::Module; package Class::MOP::Class; -sub construct_class_instance { - Class::MOP::Deprecated::deprecated( - 'The construct_class_instance method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_check_metaclass_compatibility(@_); -} - -sub construct_instance { - Class::MOP::Deprecated::deprecated( - 'The construct_instance method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - shift->_construct_instance(@_); -} - -sub create_meta_instance { - Class::MOP::Deprecated::deprecated( - 'The create_meta_instance method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - shift->_create_meta_instance(@_); -} - -sub clone_instance { - Class::MOP::Deprecated::deprecated( - 'The clone_instance method has been made private.' - . ' 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. This method will be removed in the Moose 2.0200 release.'); - - shift->add_method(@_); -} - -sub compute_all_applicable_methods { - Class::MOP::Deprecated::deprecated( - 'The compute_all_applicable_methods method is deprecated.' - . ' Use get_all_methods instead. This method will be removed in the Moose 2.0200 release.' ); - - return map { - { - name => $_->name, - class => $_->package_name, - code => $_, # sigh, overloading - }, - } shift->get_all_methods(@_); -} - -sub compute_all_applicable_attributes { - Class::MOP::Deprecated::deprecated( - 'The compute_all_applicable_attributes method has been deprecated.' - . ' 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. This method will be removed in the Moose 2.0200 release.'); - - shift->_attribute_map(@_); -} - package Class::MOP::Instance; -sub bless_instance_structure { - Class::MOP::Deprecated::deprecated( - 'The bless_instance_structure method is deprecated.' - . ' This method will be removed in the Moose 2.0200 release.' ); - - my ( $self, $instance_structure ) = @_; - bless $instance_structure, $self->_class_name; -} - package Class::MOP::Attribute; -sub process_accessors { - Class::MOP::Deprecated::deprecated( - 'The process_accessors method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - shift->_process_accessors(@_); -} - package Class::MOP::Method::Accessor; -sub initialize_body { - Class::MOP::Deprecated::deprecated( - 'The initialize_body method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - shift->_initialize_body; -} - -sub generate_accessor_method { - Class::MOP::Deprecated::deprecated( - 'The generate_accessor_method method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_generate_clearer_method_inline; -} - package Class::MOP::Method::Constructor; -sub meta_instance { - Class::MOP::Deprecated::deprecated( - 'The meta_instance method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - shift->_meta_instance; -} - -sub attributes { - Class::MOP::Deprecated::deprecated( - 'The attributes method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - - return shift->_attributes; -} - -sub initialize_body { - Class::MOP::Deprecated::deprecated( - 'The initialize_body method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - shift->_initialize_body; -} - -sub generate_constructor_method { - Class::MOP::Deprecated::deprecated( - 'The generate_constructor_method method has been made private.' - . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.' - ); - shift->_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. This method will be removed in the Moose 2.0200 release.' - ); - shift->_generate_constructor_method_inline; -} - 1; __END__ diff --git a/lib/Moose.pm b/lib/Moose.pm index df95790..e090be4 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -132,22 +132,6 @@ Moose::Exporter->setup_import_methods( ); sub init_meta { - # This used to be called as a function. This hack preserves - # backwards compatibility. - if ( $_[0] ne __PACKAGE__ ) { - Moose::Deprecated::deprecated( - feature => 'Moose::init_meta', - message => 'Calling Moose::init_meta as a function is deprecated.' - . ' Doing so will throw an error in Moose 2.0200.' - ); - - return __PACKAGE__->init_meta( - for_class => $_[0], - base_class => $_[1], - metaclass => $_[2], - ); - } - shift; my %args = @_; diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 495a9bb..c251b65 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -452,29 +452,6 @@ sub apply { Class::MOP::load_class($application_class); - my $deprecation_check = 0; - - if ( exists $args{excludes} && !exists $args{'-excludes'} ) { - $args{'-excludes'} = delete $args{excludes}; - $deprecation_check = 1; - } - if ( exists $args{alias} && !exists $args{'-alias'} ) { - $args{'-alias'} = delete $args{alias}; - $deprecation_check = 1; - } - - if ( $deprecation_check ) { - Moose::Deprecated::deprecated( - feature => 'alias or excludes', - message => - '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}?).". - ' This will be an error in Moose 2.0200.' - ); - } - if ( exists $args{'-excludes'} ) { # I wish we had coercion here :) $args{'-excludes'} = ( diff --git a/lib/Moose/Util/MetaRole.pm b/lib/Moose/Util/MetaRole.pm index 150382e..b68294f 100644 --- a/lib/Moose/Util/MetaRole.pm +++ b/lib/Moose/Util/MetaRole.pm @@ -10,22 +10,9 @@ use List::Util qw( first ); use Moose::Deprecated; use Scalar::Util qw( blessed ); -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.' - . ' Using this API will throw an error in Moose 2.0200.' - ); - - goto &apply_metaroles; -} - sub apply_metaroles { my %args = @_; - _fixup_old_style_args(\%args); - my $for = _metathing_for( $args{for} ); if ( $for->isa('Moose::Meta::Role') ) { @@ -76,65 +63,6 @@ sub _metathing_for { } } -sub _fixup_old_style_args { - my $args = shift; - - return if $args->{class_metaroles} || $args->{role_metaroles}; - - Moose::Deprecated::deprecated( - feature => 'pre-0.94 MetaRole API', - message => - '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} - if exists $args->{for_class}; - - my @old_keys = qw( - attribute_metaclass_roles - method_metaclass_roles - wrapped_method_metaclass_roles - instance_metaclass_roles - constructor_class_roles - destructor_class_roles - error_class_roles - - application_to_class_class_roles - application_to_role_class_roles - application_to_instance_class_roles - application_role_summation_class_roles - ); - - my $for - = blessed $args->{for} - ? $args->{for} - : Class::MOP::class_of( $args->{for} ); - - my $top_key; - if ( $for->isa('Moose::Meta::Class') ) { - $top_key = 'class_metaroles'; - - $args->{class_metaroles}{class} = delete $args->{metaclass_roles} - if exists $args->{metaclass_roles}; - } - else { - $top_key = 'role_metaroles'; - - $args->{role_metaroles}{role} = delete $args->{metaclass_roles} - if exists $args->{metaclass_roles}; - } - - for my $old_key (@old_keys) { - my ($new_key) = $old_key =~ /^(.+)_(?:class|metaclass)_roles$/; - - $args->{$top_key}{$new_key} = delete $args->{$old_key} - if exists $args->{$old_key}; - } - - return; -} - sub _make_new_metaclass { my $for = shift; my $roles = shift; diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index 805a3d1..4ab0006 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -269,18 +269,6 @@ sub register_type_constraint { # type constructors sub type { - - # back-compat version, called without sugar - if ( !any { ( reftype($_) || '' ) eq 'HASH' } @_ ) { - Moose::Deprecated::deprecated( - feature => 'type without sugar', - message => - '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] ); - } - my $name = shift; my %p = map { %{$_} } @_; @@ -292,44 +280,6 @@ sub type { } sub subtype { - - # crazy back-compat code for being called without sugar ... - # - # subtype 'Parent', sub { where }; - if ( scalar @_ == 2 && ( reftype( $_[1] ) || '' ) eq 'CODE' ) { - Moose::Deprecated::deprecated( - feature => 'subtype without sugar', - message => - 'Calling subtype() with a simple list of parameters is deprecated. This will be an error in Moose 2.0200.' - ); - - return _create_type_constraint( undef, @_ ); - } - - # subtype 'Parent', sub { where }, sub { message }; - # subtype 'Parent', sub { where }, sub { message }, sub { optimized }; - if ( scalar @_ >= 3 && all { ( reftype($_) || '' ) eq 'CODE' } - @_[ 1 .. $#_ ] ) { - Moose::Deprecated::deprecated( - feature => 'subtype without sugar', - message => - 'Calling subtype() with a simple list of parameters is deprecated. This will be an error in Moose 2.0200.' - ); - - return _create_type_constraint( undef, @_ ); - } - - # subtype 'Name', 'Parent', ... - if ( scalar @_ >= 2 && all { !ref } @_[ 0, 1 ] ) { - Moose::Deprecated::deprecated( - feature => 'subtype without sugar', - message => - 'Calling subtype() with a simple list of parameters is deprecated. This will be an error in Moose 2.0200.' - ); - - return _create_type_constraint(@_); - } - if ( @_ == 1 && !ref $_[0] ) { __PACKAGE__->_throw_error( 'A subtype cannot consist solely of a name, it must have a parent' diff --git a/lib/Moose/Util/TypeConstraints/Builtins.pm b/lib/Moose/Util/TypeConstraints/Builtins.pm index 832f592..7fbe021 100644 --- a/lib/Moose/Util/TypeConstraints/Builtins.pm +++ b/lib/Moose/Util/TypeConstraints/Builtins.pm @@ -130,11 +130,6 @@ sub define_builtins { => where { blessed($_) } => inline_as { 'Scalar::Util::blessed(' . $_[1] . ')' }; - # This type is deprecated. - subtype 'Role' - => as 'Object' - => where { $_->can('does') }; - subtype 'ClassName' => as 'Str' => where { Class::MOP::is_class_loaded($_) }