From: Florian Ragwitz Date: Tue, 7 Apr 2009 15:12:01 +0000 (+0200) Subject: Include stack traces in the deprecation warnings. X-Git-Tag: 0.81~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c7e28c19d202edf402bea55892ccb3460774bb81;p=gitmo%2FClass-MOP.git Include stack traces in the deprecation warnings. --- diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index 70c190c..7f68060 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -20,12 +20,12 @@ use Class::MOP::Method; use Class::MOP::Immutable; BEGIN { - *IS_RUNNING_ON_5_10 = ($] < 5.009_005) + *IS_RUNNING_ON_5_10 = ($] < 5.009_005) ? sub () { 0 } - : sub () { 1 }; + : sub () { 1 }; sub HAVE_ISAREV () { - warn "Class::MOP::HAVE_ISAREV is deprecated and will be removed in a future release. It has always returned 1 anyway."; + Carp::cluck("Class::MOP::HAVE_ISAREV is deprecated and will be removed in a future release. It has always returned 1 anyway."); return 1; } @@ -36,7 +36,7 @@ BEGIN { our $VERSION = '0.80_01'; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; -our $AUTHORITY = 'cpan:STEVAN'; +our $AUTHORITY = 'cpan:STEVAN'; require XSLoader; XSLoader::load( __PACKAGE__, $XS_VERSION ); diff --git a/lib/Class/MOP/Attribute.pm b/lib/Class/MOP/Attribute.pm index 775ac9f..ed8a387 100644 --- a/lib/Class/MOP/Attribute.pm +++ b/lib/Class/MOP/Attribute.pm @@ -329,8 +329,8 @@ sub clear_value { 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"; + Carp::cluck('The process_accessors method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_process_accessors; } diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index c9a910a..8e0c03f 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -39,8 +39,8 @@ 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"; + Carp::cluck('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; } @@ -154,8 +154,8 @@ 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"; + Carp::cluck('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; } @@ -343,8 +343,8 @@ sub new_object { } sub construct_instance { - warn 'The construct_instance method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n"; + Carp::cluck('The construct_instance method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_construct_instance; } @@ -378,8 +378,8 @@ 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"; + Carp::cluck('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; } @@ -412,8 +412,8 @@ 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"; + Carp::cluck('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; } @@ -669,7 +669,7 @@ sub add_method { } sub alias_method { - warn "The alias_method method is deprecated. Use add_method instead.\n"; + Carp::cluck("The alias_method method is deprecated. Use add_method instead.\n"); shift->add_method; } @@ -733,8 +733,8 @@ sub get_all_methods { } sub compute_all_applicable_methods { - warn 'The compute_all_applicable_methods method is deprecated.' - . " Use get_all_methods instead.\n"; + Carp::cluck('The compute_all_applicable_methods method is deprecated.' + . " Use get_all_methods instead.\n"); return map { { @@ -926,8 +926,8 @@ sub get_all_attributes { } sub compute_all_applicable_attributes { - warn 'The compute_all_applicable_attributes method has been deprecated.' - . " Use get_all_attributes instead.\n"; + Carp::cluck('The compute_all_applicable_attributes method has been deprecated.' + . " Use get_all_attributes instead.\n"); shift->get_all_attributes; } diff --git a/lib/Class/MOP/Instance.pm b/lib/Class/MOP/Instance.pm index b1f713b..ca0e061 100644 --- a/lib/Class/MOP/Instance.pm +++ b/lib/Class/MOP/Instance.pm @@ -75,8 +75,8 @@ sub create_instance { # for compatibility sub bless_instance_structure { - warn 'The bless_instance_structure method is deprecated.' - . " It will be removed in a future release.\n"; + Carp::cluck('The bless_instance_structure method is deprecated.' + . " It will be removed in a future release.\n"); my ($self, $instance_structure) = @_; bless $instance_structure, $self->_class_name; diff --git a/lib/Class/MOP/Method/Accessor.pm b/lib/Class/MOP/Method/Accessor.pm index 4620c1d..773beb5 100644 --- a/lib/Class/MOP/Method/Accessor.pm +++ b/lib/Class/MOP/Method/Accessor.pm @@ -58,8 +58,8 @@ sub accessor_type { (shift)->{'accessor_type'} } ## factory 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"; + Carp::cluck('The initialize_body method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_initialize_body; } @@ -80,8 +80,8 @@ sub _initialize_body { ## generators 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"; + Carp::cluck('The generate_accessor_method method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_accessor_method; } @@ -94,8 +94,8 @@ 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"; + Carp::cluck('The generate_reader_method method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_reader_method; } @@ -108,8 +108,8 @@ 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"; + Carp::cluck('The generate_writer_method method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_writer_method; } @@ -121,8 +121,8 @@ 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"; + Carp::cluck('The generate_predicate_method method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_predicate_method; } @@ -134,8 +134,8 @@ 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"; + Carp::cluck('The generate_clearer_method method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_clearer_method; } @@ -149,8 +149,8 @@ sub _generate_clearer_method { ## Inline methods 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"; + Carp::cluck('The generate_accessor_method_inline method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_accessor_method_inline; } @@ -174,8 +174,8 @@ 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"; + Carp::cluck('The generate_reader_method_inline method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_reader_method_inline; } @@ -198,8 +198,8 @@ 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"; + Carp::cluck('The generate_writer_method_inline method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_writer_method_inline; } @@ -221,8 +221,8 @@ 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"; + Carp::cluck('The generate_predicate_method_inline method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_predicate_method_inline; } @@ -244,8 +244,8 @@ 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"; + Carp::cluck('The generate_clearer_method_inline method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_clearer_method_inline; } diff --git a/lib/Class/MOP/Method/Constructor.pm b/lib/Class/MOP/Method/Constructor.pm index e9a5d55..a53aded 100644 --- a/lib/Class/MOP/Method/Constructor.pm +++ b/lib/Class/MOP/Method/Constructor.pm @@ -62,8 +62,8 @@ sub associated_metaclass { (shift)->{'associated_metaclass'} } ## cached values ... 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"; + Carp::cluck('The meta_instance method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_meta_instance; } @@ -73,8 +73,8 @@ sub _meta_instance { } sub attributes { - warn 'The attributes method has been made private.' - . " The public version is deprecated and will be removed in a future release.\n"; + Carp::cluck('The attributes method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); return shift->_attributes; } @@ -87,8 +87,8 @@ sub _attributes { ## method 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"; + Carp::cluck('The initialize_body method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_initialize_body; } @@ -102,8 +102,8 @@ 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"; + Carp::cluck('The generate_constructor_method method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_constructor_method; } @@ -112,8 +112,8 @@ 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"; + Carp::cluck('The generate_constructor_method_inline method has been made private.' + . " The public version is deprecated and will be removed in a future release.\n"); shift->_generate_constructor_method_inline; }