Checking in changes prior to tagging of version 0.73.
[gitmo/Mouse.git] / lib / Mouse / Meta / Method / Accessor.pm
old mode 100755 (executable)
new mode 100644 (file)
index 670d721..2c5920a
@@ -33,7 +33,7 @@ sub _generate_accessor_any{
         }
         else{ # writer
             $accessor .= 
-                'if(@_ < 2){ Carp::confess("Not enough arguments for the writer of '.$name.'") }'.
+                'if(@_ < 2){ Carp::confess("Not enough arguments for the writer of $name") }'.
                 '{' . "\n";
         }
                 
@@ -69,13 +69,13 @@ sub _generate_accessor_any{
         $accessor .= "}\n";
     }
     elsif($type eq 'ro') {
-        $accessor .= 'Carp::confess("Cannot assign a value to a read-only accessor") if scalar(@_) >= 2;' . "\n";
+        $accessor .= 'Carp::confess("Cannot assign a value to a read-only accessor of $name") if scalar(@_) >= 2;' . "\n";
     }
     else{
         $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)";
@@ -182,7 +182,7 @@ Mouse::Meta::Method::Accessor - A Mouse method generator for accessors
 
 =head1 VERSION
 
-This document describes Mouse version 0.53
+This document describes Mouse version 0.73
 
 =head1 SEE ALSO