exists $p{birth_date}
or confess 'birth_date is a required attribute';
- $p{birth_date} = $class->_coerce_birth_date($date );
- $class->_validate_birth_date( $date );
+ $p{birth_date} = $class->_coerce_birth_date( $p{birth_date} );
+ $class->_validate_birth_date( $p{birth_date} );
$p{shirt_size} = 'l'
unless exists $p{shirt_size}:
$class->_validate_shirt_size( $p{shirt_size} );
- my %self = map { $_ => $p{$_} } qw( name shirt_size );
- $self{birth_date} = $date;
-
- return bless \%self, $class;
+ return bless \%p, $class;
}
sub _validate_name {