line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FormValidator::LazyWay::Rule::DateTime; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
227198
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
177
|
|
4
|
5
|
|
|
5
|
|
28
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
197
|
|
5
|
5
|
|
|
5
|
|
3437
|
use utf8; |
|
5
|
|
|
|
|
41
|
|
|
5
|
|
|
|
|
33
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
6412
|
use DateTime::Format::Strptime; |
|
5
|
|
|
|
|
1784311
|
|
|
5
|
|
|
|
|
1751
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub datetime { |
10
|
10
|
|
|
10
|
0
|
24695
|
my ( $datetime, $args ) = @_; |
11
|
10
|
100
|
|
|
|
38
|
unless ( $args->{pattern} ) { |
12
|
8
|
|
|
|
|
20
|
$args->{pattern} = '%Y-%m-%d %H:%M:%S'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
10
|
|
|
|
|
14
|
my $strp = DateTime::Format::Strptime->new( %{$args} ); |
|
10
|
|
|
|
|
57
|
|
16
|
10
|
|
|
|
|
3529
|
my $dt = eval { $strp->parse_datetime($datetime) }; |
|
10
|
|
|
|
|
41
|
|
17
|
10
|
100
|
|
|
|
4886
|
return $dt ? 1 : 0; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub date { |
21
|
9
|
|
|
9
|
0
|
20970
|
my ( $date, $args ) = @_; |
22
|
9
|
100
|
|
|
|
35
|
unless ( $args->{pattern} ) { |
23
|
7
|
|
|
|
|
29
|
$args->{pattern} = '%Y-%m-%d'; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
9
|
|
|
|
|
12
|
my $strp = DateTime::Format::Strptime->new( %{$args} ); |
|
9
|
|
|
|
|
68
|
|
27
|
9
|
|
|
|
|
3861
|
my $dt = eval { $strp->parse_datetime($date) }; |
|
9
|
|
|
|
|
40
|
|
28
|
9
|
100
|
|
|
|
5435
|
return $dt ? 1 : 0; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub time { |
32
|
5
|
|
|
5
|
0
|
17859
|
my ( $time, $args ) = @_; |
33
|
5
|
100
|
|
|
|
20
|
unless ( $args->{pattern} ) { |
34
|
4
|
|
|
|
|
11
|
$args->{pattern} = '%H:%M:%S'; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
5
|
|
|
|
|
6
|
my $strp = DateTime::Format::Strptime->new( %{$args} ); |
|
5
|
|
|
|
|
34
|
|
38
|
5
|
|
|
|
|
2052
|
my $dt = eval { $strp->parse_datetime($time) }; |
|
5
|
|
|
|
|
21
|
|
39
|
5
|
100
|
|
|
|
2240
|
return $dt ? 1 : 0; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |