line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::Constraint::Time; |
2
|
|
|
|
|
|
|
|
3
|
88
|
|
|
88
|
|
73724
|
use warnings; |
|
88
|
|
|
|
|
215
|
|
|
88
|
|
|
|
|
2649
|
|
4
|
88
|
|
|
88
|
|
546
|
use strict; |
|
88
|
|
|
|
|
185
|
|
|
88
|
|
|
|
|
3443
|
|
5
|
88
|
|
|
88
|
|
508
|
use base 'HTML::Widget::Constraint'; |
|
88
|
|
|
|
|
472
|
|
|
88
|
|
|
|
|
6614
|
|
6
|
88
|
|
|
88
|
|
559
|
use Date::Calc; |
|
88
|
|
|
|
|
178
|
|
|
88
|
|
|
|
|
34009
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
HTML::Widget::Constraint::Time - Time Constraint |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $c = $widget->constraint( 'Time', 'hour', 'minute', 'second' ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Time Constraint. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 process |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub process { |
27
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $w, $params ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
18
|
return [] |
30
|
2
|
50
|
33
|
|
|
9
|
unless ( $self->names && @{ $self->names } == 3 ); |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
17
|
my ( $hour, $min, $sec ) = @{ $self->names }; |
|
2
|
|
|
|
|
4
|
|
33
|
2
|
|
50
|
|
|
16
|
my $h = $params->{$hour} || 0; |
34
|
2
|
|
50
|
|
|
8
|
my $m = $params->{$min} || 0; |
35
|
2
|
|
50
|
|
|
5
|
my $s = $params->{$sec} || 0; |
36
|
2
|
50
|
33
|
|
|
34
|
return [] unless ( $h && $m && $s ); |
|
|
|
33
|
|
|
|
|
37
|
2
|
|
|
|
|
4
|
my $results = []; |
38
|
|
|
|
|
|
|
|
39
|
2
|
100
|
33
|
|
|
41
|
unless ( $h =~ /^\d+$/ |
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
40
|
|
|
|
|
|
|
&& $m =~ /^\d+$/ |
41
|
|
|
|
|
|
|
&& $s =~ /^\d+$/ |
42
|
|
|
|
|
|
|
&& Date::Calc::check_time( $h, $m, $s ) ) |
43
|
|
|
|
|
|
|
{ |
44
|
1
|
|
|
|
|
24
|
push @$results, HTML::Widget::Error->new( |
45
|
|
|
|
|
|
|
{ name => $hour, message => $self->mk_message } ); |
46
|
1
|
|
|
|
|
16
|
push @$results, HTML::Widget::Error->new( |
47
|
|
|
|
|
|
|
{ name => $min, message => $self->mk_message } ); |
48
|
1
|
|
|
|
|
14
|
push @$results, HTML::Widget::Error->new( |
49
|
|
|
|
|
|
|
{ name => $sec, message => $self->mk_message } ); |
50
|
|
|
|
|
|
|
} |
51
|
2
|
|
|
|
|
33
|
return $results; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 AUTHOR |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Sebastian Riedel, C |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 LICENSE |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
61
|
|
|
|
|
|
|
the same terms as Perl itself. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |