Moose compat: throw an error on $self->reader(value)
[gitmo/Mouse.git] / lib / Mouse / Attribute.pm
index 1a971bf..b5dfb1d 100644 (file)
@@ -78,6 +78,7 @@ sub generate_accessor {
         $accessor .= '}';
     }
     else {
+        $accessor .= 'confess "Cannot assign a value to a read-only accessor" if @_;';
     }
 
     if ($attribute->is_lazy) {