X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FAttribute.pm;h=2430aec0b174e1bf72cf6d7098ec40859df5ca49;hb=d7f17ebbbf3b45f39ea4f3ab2e7912520818264c;hp=e7a40bc3e7f823c197dd0d061c87fd9888f330b8;hpb=8339fae27b21432891dd83b9cbd97ae1928c75d8;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index e7a40bc..2430aec 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -133,6 +133,14 @@ sub generate_writer_method { } } +sub generate_reader_method { + my ($self, $attr_name) = @_; + sub { + confess "Cannot assign a value to a read-only accessor" if @_ > 1; + $_[0]->{$attr_name} + }; +} + 1; __END__ @@ -169,6 +177,8 @@ will behave just as L does. =item B +=item B + =back =head2 Additional Moose features