X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMethod%2FAccessor.pm;h=427d27b130c110df54a572ab57797634a50f7374;hb=c6e75cb33bd9fd33d777325cdc3de6d5de614263;hp=dcf5f32621538a0f56f914a646171d13f149d192;hpb=e9497117f84bf41a21275cb7a0045b6e775a902e;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Method/Accessor.pm b/lib/Class/MOP/Method/Accessor.pm index dcf5f32..427d27b 100644 --- a/lib/Class/MOP/Method/Accessor.pm +++ b/lib/Class/MOP/Method/Accessor.pm @@ -7,7 +7,7 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken'; -our $VERSION = '0.78'; +our $VERSION = '0.81'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -58,16 +58,16 @@ 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"; - goto &_initialize_body; + 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; } sub _initialize_body { my $self = shift; my $method_name = join "_" => ( - 'generate', + '_generate', $self->accessor_type, 'method', ($self->is_inline ? 'inline' : ()) @@ -80,6 +80,12 @@ sub _initialize_body { ## generators sub generate_accessor_method { + 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; +} + +sub _generate_accessor_method { my $attr = (shift)->associated_attribute; return sub { $attr->set_value($_[0], $_[1]) if scalar(@_) == 2; @@ -88,6 +94,12 @@ sub generate_accessor_method { } sub generate_reader_method { + 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; +} + +sub _generate_reader_method { my $attr = (shift)->associated_attribute; return sub { confess "Cannot assign a value to a read-only accessor" if @_ > 1; @@ -96,6 +108,12 @@ sub generate_reader_method { } sub generate_writer_method { + 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; +} + +sub _generate_writer_method { my $attr = (shift)->associated_attribute; return sub { $attr->set_value($_[0], $_[1]); @@ -103,6 +121,12 @@ sub generate_writer_method { } sub generate_predicate_method { + 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; +} + +sub _generate_predicate_method { my $attr = (shift)->associated_attribute; return sub { $attr->has_value($_[0]) @@ -110,6 +134,12 @@ sub generate_predicate_method { } sub generate_clearer_method { + 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; +} + +sub _generate_clearer_method { my $attr = (shift)->associated_attribute; return sub { $attr->clear_value($_[0]) @@ -118,8 +148,13 @@ sub generate_clearer_method { ## Inline methods - sub generate_accessor_method_inline { + 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; +} + +sub _generate_accessor_method_inline { my $self = shift; my $attr = $self->associated_attribute; my $attr_name = $attr->name; @@ -139,6 +174,12 @@ sub generate_accessor_method_inline { } sub generate_reader_method_inline { + 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; +} + +sub _generate_reader_method_inline { my $self = shift; my $attr = $self->associated_attribute; my $attr_name = $attr->name; @@ -157,6 +198,12 @@ sub generate_reader_method_inline { } sub generate_writer_method_inline { + 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; +} + +sub _generate_writer_method_inline { my $self = shift; my $attr = $self->associated_attribute; my $attr_name = $attr->name; @@ -173,8 +220,13 @@ sub generate_writer_method_inline { return $code; } - sub generate_predicate_method_inline { + 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; +} + +sub _generate_predicate_method_inline { my $self = shift; my $attr = $self->associated_attribute; my $attr_name = $attr->name; @@ -192,6 +244,12 @@ sub generate_predicate_method_inline { } sub generate_clearer_method_inline { + 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; +} + +sub _generate_clearer_method_inline { my $self = shift; my $attr = $self->associated_attribute; my $attr_name = $attr->name;