| 1 | package HTML::DateSelector; | ||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 3 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 3 | ▶ | use 5.008001; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 3 | our $VERSION = '0.05'; | |||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 0 | ▶ | sub _this_year { | ||||||||||||||||||
|
Subroutine
_this_year: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 9 | 0 | my ($class, ) = @_; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 0 | my @localtime = localtime; | |||||||||||||||||||
| 12 | 0 | return $localtime[5] + 1900; | |||||||||||||||||||
| 13 | } | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 3 | ▶ | sub year { | ||||||||||||||||||
|
Subroutine
year: called CC=3 SCAR=12.7
Pod
documented
| |||||||||||||||||||||
| 16 | 3 | my ($class, $prefix, $options) = @_; | |||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 3 | ▶ | my $start = $options->{start_year} || $class->_this_year - 5; | ||||||||||||||||||
|
Condition33%1/3
$options->{'start_year'} || $class->_this_year - 5
MC/DC0%0/2
$options->{'start_year'} || $class->_this_year - 5
$options->{'start_year'}
$class->_this_year - 5
Truth table33%1/3
A || B
A= $options->{'start_year'}B= $class->_this_year - 5
| |||||||||||||||||||||
| 19 | 3 | ▶ | my $end = $options->{end_year} || $class->_this_year + 5; | ||||||||||||||||||
|
Condition33%1/3
$options->{'end_year'} || $class->_this_year + 5
MC/DC0%0/2
$options->{'end_year'} || $class->_this_year + 5
$options->{'end_year'}
$class->_this_year + 5
Truth table33%1/3
A || B
A= $options->{'end_year'}B= $class->_this_year + 5
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 3 | return $class->_select_html($prefix, 'year', $start, $end, $options); | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 4 | ▶ | sub month { | ||||||||||||||||||
|
Subroutine
month: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 25 | 4 | my ($class, $prefix, $options) = @_; | |||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 4 | return $class->_select_html($prefix, 'month', 1, 12, $options); | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 2 | ▶ | sub day { | ||||||||||||||||||
|
Subroutine
day: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 31 | 2 | my ($class, $prefix, $options) = @_; | |||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 2 | return $class->_select_html($prefix, 'day', 1, 31, $options); | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 1 | ▶ | sub hour { | ||||||||||||||||||
|
Subroutine
hour: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 37 | 1 | my ($class, $prefix, $options) = @_; | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 1 | return $class->_select_html($prefix, 'hour', 0, 23, $options); | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 1 | ▶ | sub minute { | ||||||||||||||||||
|
Subroutine
minute: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 43 | 1 | my ($class, $prefix, $options) = @_; | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 1 | return $class->_select_html($prefix, 'minute', 0, 59, $options); | |||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 11 | ▶ | sub _select_html { | ||||||||||||||||||
|
Subroutine
_select_html: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 49 | 11 | my ($class, $prefix, $type, $start, $end, $options) = @_; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 11 | my $result = ''; | |||||||||||||||||||
| 52 | 11 | $result .= qq{<select name="${prefix}_$type" id="${prefix}_$type">\n}; | |||||||||||||||||||
| 53 | 11 | ▶ | $result .= qq{<option value=""></option>\n} if $options->{include_blank}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 54 | 11 | for my $i ($start..$end) { | |||||||||||||||||||
| 55 | 209 | $result .= qq{<option value="$i">$i</option>\n}; | |||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | 11 | $result .= qq{</select>}; | |||||||||||||||||||
| 58 | 11 | return $result; | |||||||||||||||||||
| 59 | } | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 1 | ▶ | sub ymd { | ||||||||||||||||||
|
Subroutine
ymd: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 62 | 1 | my ( $class, $prefix, $options ) = @_; | |||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | 1 | return join( "\n\n", | |||||||||||||||||||
| 65 | $class->ym($prefix, $options), | ||||||||||||||||||||
| 66 | $class->day( $prefix, $options ) ); | ||||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 2 | ▶ | sub ym { | ||||||||||||||||||
|
Subroutine
ym: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 70 | 2 | my ( $class, $prefix, $options ) = @_; | |||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 2 | return join( "\n\n", | |||||||||||||||||||
| 73 | $class->year( $prefix, $options ), | ||||||||||||||||||||
| 74 | $class->month( $prefix, $options ), | ||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||
| 76 | } | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | 3 | 1; | |||||||||||||||||||
| 79 | __END__ | ||||||||||||||||||||