Handle defaults with quote-breaking values correctly by using
[gitmo/Moose.git] / lib / Moose / Meta / Method / Constructor.pm
index 644ed93..655a9b8 100644 (file)
@@ -392,10 +392,7 @@ sub _generate_default_value {
         return '$attrs->[' . $index . ']->default($instance)';
     }
     else {
-        my $default = $attr->default;
-        # make sure to quote strings ...
-        return "'$default'";
-        
+        return q{"} . quotemeta( $attr->default ) . q{"};
     }
 }