Fix a possible syntax error in generated constructor
gfx [Thu, 8 Oct 2009 11:19:58 +0000 (20:19 +0900)]
lib/Mouse/Meta/Method/Constructor.pm

index 97e1603..a7fd556 100644 (file)
@@ -83,7 +83,7 @@ sub _generate_processattrs {
             $code .= "if (exists $value) {\n";
 
             if($need_coercion){
-                $value = "$instance_slot = $constraint_var->coerce($value);\n";
+                $value = "$constraint_var->coerce($value)";
             }
 
             $code .= "$instance_slot = $value;\n";
@@ -91,7 +91,7 @@ sub _generate_processattrs {
 
             if ($attr->has_trigger) {
                 $has_triggers++;
-                $code .= "push \@triggers, [$attr_var\->{trigger}, $value];\n";
+                $code .= "push \@triggers, [$attr_var\->{trigger}, $instance_slot];\n";
             }
 
             $code .= "\n} else {\n";