Fix default and weak stuff
[gitmo/Mouse.git] / lib / Mouse / Meta / Method / Accessor.pm
index a71266a..2f03b9d 100755 (executable)
@@ -104,6 +104,9 @@ sub _generate_accessor{
         else{
             $accessor .= "$slot = $value;\n";
         }
+        if ($is_weak) {
+            $accessor .= "Scalar::Util::weaken($slot) if ref $slot;\n";
+        }
         $accessor .= "}\n";
     }