coerce value from eager defaults
Alex J. G. BurzyƄski [Sat, 21 May 2011 15:35:17 +0000 (17:35 +0200)]
lib/Method/Generate/Accessor.pm

index 65173ef..078e884 100644 (file)
@@ -305,6 +305,12 @@ sub _generate_populate_set {
             .$get_default
             ."\n${get_indent})"
         : $get_default;
+    if ( $spec->{coerce} ) {
+        $get_value = $self->_generate_coerce(
+            $name, $me, $get_value,
+            $spec->{coerce}
+          )
+    }
     ($spec->{isa}
       ? "    {\n      my \$value = ".$get_value.";\n      "
         .$self->_generate_isa_check(