From: Alex J. G. BurzyƄski Date: Sat, 21 May 2011 15:35:17 +0000 (+0200) Subject: coerce value from eager defaults X-Git-Tag: release_0.009009~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7fe3b88684e1c3443822e7969d81d6b5886ab7df;p=gitmo%2FRole-Tiny.git coerce value from eager defaults --- diff --git a/lib/Method/Generate/Accessor.pm b/lib/Method/Generate/Accessor.pm index 65173ef..078e884 100644 --- a/lib/Method/Generate/Accessor.pm +++ b/lib/Method/Generate/Accessor.pm @@ -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(