From: Dave Rolsky Date: Wed, 3 Sep 2008 05:27:36 +0000 (+0000) Subject: Fix coercions X-Git-Tag: 0.57~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=50c221c5848199ff4852a0c0cf935575ad8b19de;p=gitmo%2FMoose.git Fix coercions --- diff --git a/lib/Moose/Unsweetened.pod b/lib/Moose/Unsweetened.pod index 4da4c4c..2dc114f 100644 --- a/lib/Moose/Unsweetened.pod +++ b/lib/Moose/Unsweetened.pod @@ -106,8 +106,7 @@ helpers like C. exists $p{birth_date} or confess 'birth_date is a required attribute'; - my $date = $p{birth_date}; - $class->_coerce_birth_date( \$date ); + $p{birth_date} = $class->_coerce_birth_date($date ); $class->_validate_birth_date( $date ); $p{shirt_size} = 'l' @@ -141,7 +140,7 @@ helpers like C. shift; my $date = shift; - return unless defined $date && ! ref $date; + return $date unless defined $date && ! ref $date; my $dt = $en_parser->parse_datetime($date); @@ -187,10 +186,9 @@ helpers like C. my $self = shift; if (@_) { - my $date = shift; - - $self->_coerce_birth_date( $date ); + my $date = $self->_coerce_birth_date( $_[0] ); $self->_validate_birth_date( $date ); + $self->{birth_date} = $date; }