--- trunk/lib/App/RoomReservation/Reservation.pm 2009/06/29 12:11:14 1104 +++ trunk/lib/App/RoomReservation/Reservation.pm 2009/06/30 09:42:37 1118 @@ -1,6 +1,14 @@ package App::RoomReservation::Reservation; use Moose; +use Moose::Util::TypeConstraints; +use Regexp::Common qw[Email::Address]; + +subtype 'Email', + as 'Str', + where { /^$RE{Email}{Address}$/ }, + message { "$_ is not valid e-mail" }; + extends 'App::RoomReservation'; use lib 'lib'; @@ -56,20 +64,20 @@ has email => ( is => 'rw', - isa => 'Str', + isa => 'Email', required => 1, ); has email_verify => ( is => 'rw', - isa => 'Str', + isa => 'Email', required => 1, ); has _confirmed => ( is => 'rw', isa => 'Bool', - required => 1, +# required => 1, default => sub { 0 }, ); @@ -82,7 +90,6 @@ warn "# cols = ",join(',', @cols), $/; sub token { - my ( $self ) = @_; my $self = shift; my $sth = $self->dbh->prepare(qq{ select md5( id || email ) from reservation where email = ?