line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::DateSelector; |
2
|
2
|
|
|
2
|
|
45184
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
4
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
192
|
|
5
|
2
|
|
|
2
|
|
58
|
use 5.008001; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
1243
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub _this_year { |
9
|
0
|
|
|
0
|
|
|
my ($class, ) = @_; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
my @localtime = localtime; |
12
|
0
|
|
|
|
|
|
return $localtime[5] + 1900; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub year { |
16
|
0
|
|
|
0
|
1
|
|
my ($class, $prefix, $options) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
0
|
|
|
|
my $start = $options->{start_year} || $class->_this_year - 5; |
19
|
0
|
|
0
|
|
|
|
my $end = $options->{end_year} || $class->_this_year + 5; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return $class->_select_html($prefix, 'year', $start, $end, $options); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub month { |
25
|
0
|
|
|
0
|
1
|
|
my ($class, $prefix, $options) = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return $class->_select_html($prefix, 'month', 1, 12, $options); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub day { |
31
|
0
|
|
|
0
|
1
|
|
my ($class, $prefix, $options) = @_; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return $class->_select_html($prefix, 'day', 1, 31, $options); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub hour { |
37
|
0
|
|
|
0
|
1
|
|
my ($class, $prefix, $options) = @_; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $class->_select_html($prefix, 'hour', 0, 23, $options); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub minute { |
43
|
0
|
|
|
0
|
1
|
|
my ($class, $prefix, $options) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return $class->_select_html($prefix, 'minute', 0, 59, $options); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _select_html { |
49
|
0
|
|
|
0
|
|
|
my ($class, $prefix, $type, $start, $end, $options) = @_; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $result = ''; |
52
|
0
|
|
|
|
|
|
$result .= qq{ |
53
|
0
|
0
|
|
|
|
|
$result .= qq{\n} if $options->{include_blank}; |
54
|
0
|
|
|
|
|
|
for my $i ($start..$end) { |
55
|
0
|
|
|
|
|
|
$result .= qq{\n}; |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
|
$result .= qq{}; |
58
|
0
|
|
|
|
|
|
return $result; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub ymd { |
62
|
0
|
|
|
0
|
1
|
|
my ( $class, $prefix, $options ) = @_; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
return join( "\n\n", |
65
|
|
|
|
|
|
|
$class->ym($prefix, $options), |
66
|
|
|
|
|
|
|
$class->day( $prefix, $options ) ); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub ym { |
70
|
0
|
|
|
0
|
1
|
|
my ( $class, $prefix, $options ) = @_; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return join( "\n\n", |
73
|
|
|
|
|
|
|
$class->year( $prefix, $options ), |
74
|
|
|
|
|
|
|
$class->month( $prefix, $options ), |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
__END__ |