From: Shawn M Moore Date: Thu, 8 May 2008 02:05:24 +0000 (+0000) Subject: add has_read_method and has_write_method X-Git-Tag: 0_64~70 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9e517e010380b50d0cfec15cdc893536fb3c84d0;p=gitmo%2FClass-MOP.git add has_read_method and has_write_method --- diff --git a/Changes b/Changes index b5514f1..571aa05 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ Revision history for Perl extension Class-MOP. +NEXT + * Class::MOP::Attribute + - add has_read_method and has_write_method + 0.55 Mon. April 28, 2008 - All classes now have proper C3 MRO support - added MRO::Compat as a dependency to allow diff --git a/lib/Class/MOP/Attribute.pm b/lib/Class/MOP/Attribute.pm index 6042f5c..c3d760b 100644 --- a/lib/Class/MOP/Attribute.pm +++ b/lib/Class/MOP/Attribute.pm @@ -167,6 +167,9 @@ sub initializer { $_[0]->{'$!initializer'} } # end bootstrapped away method section. # (all methods below here are kept intact) +sub has_read_method { $_[0]->has_reader || $_[0]->has_accessor } +sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor } + sub get_read_method { my $self = shift; my $reader = $self->reader || $self->accessor; @@ -698,6 +701,14 @@ C and C or C was specified or not. NOTE: If no reader/writer/accessor was specified, this will use the attribute get_value/set_value methods, which can be very inefficient. +=item B + +=item B + +Return whether a method exists suitable for reading / writing the value +of the attribute in the associated class. Suitable for use whether +C and C or C was used. + =back =head2 Informational predicates