From: gfx Date: Sat, 17 Apr 2010 08:13:36 +0000 (+0900) Subject: Apply a patch from Michael G Schwern X-Git-Tag: 0.54~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=52b9f5fa3ef0a987ff2fed1a51fab588b6f5e457;p=gitmo%2FMouse.git Apply a patch from Michael G Schwern http://rt.cpan.org/Public/Bug/Display.html?id=56523 --- diff --git a/lib/Mouse/Meta/Method/Accessor.pm b/lib/Mouse/Meta/Method/Accessor.pm index 670d721..f7f75cb 100755 --- a/lib/Mouse/Meta/Method/Accessor.pm +++ b/lib/Mouse/Meta/Method/Accessor.pm @@ -75,7 +75,7 @@ sub _generate_accessor_any{ $class->throw_error("Unknown accessor type '$type'"); } - if ($attribute->is_lazy) { + if ($attribute->is_lazy and $type ne 'wo') { my $value; if (defined $builder){ @@ -88,7 +88,7 @@ sub _generate_accessor_any{ $value = '$default'; } - $accessor .= "els" if $type eq 'rw' || $type eq 'wo'; + $accessor .= "els" if $type eq 'rw'; $accessor .= "if(!exists $slot){\n"; if($should_coerce){ $accessor .= "$slot = \$constraint->coerce($value)";