TurboForm/Constraint/Date.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 36 CC 2 SCAR 11.5
CC
2
Cov
0%
check
6.0
message
2.0
BEGIN
2.0
CRAP 3.1
1 package HTML::TurboForm::Constraint::Date;
2 use warnings;
3 use strict;
4 use Date::Calc qw/check_date/;
5 use base qw(HTML::TurboForm::Constraint);
6  
7 sub check{
8 my ($self)=@_;
9 my $result=0;
10  
11 my $day='';
12 my $month='';
13 my $year='';
14 my $request=$self->request;
15  
16 $day=$request->{$self->{name}.'_day'};# if (exists($request->{$self->{name}.'_day'}));
17 $month=$request->{$self->{name}.'_month'};# if (exists($request->{$self->{name}.'_month'}));
18 $year=$request->{$self->{name}.'_year'};# if (exists($request->{$self->{name}.'year'})) ;
19  
20 return 1 if( check_date( $year,$month,$day ) );
21 return 0;
22 }
23  
24 sub message{
25 my ($self)=@_;
26 return $self->{text};
27 }
28  
29 1;
30  
31 __END__