| 1 | package Rose::HTML::Form::Field::DateTime::Split::MDYHMS; | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 4 | |||||||||||||||||||||||
| 5 | 5 | ▶ | use Rose::DateTime::Util(); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 6 | |||||||||||||||||||||||
| 7 | 5 | ▶ | use Rose::HTML::Form::Field::DateTime::Split::MonthDayYear; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 8 | 5 | ▶ | use Rose::HTML::Form::Field::Time::Split::HourMinuteSecond; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 9 | |||||||||||||||||||||||
| 10 | 5 | ▶ | use base 'Rose::HTML::Form::Field::DateTime::Split'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 11 | |||||||||||||||||||||||
| 12 | 5 | our $VERSION = '0.550'; | |||||||||||||||||||||
| 13 | |||||||||||||||||||||||
| 14 | sub build_field | ||||||||||||||||||||||
| 15 | 18 | ▶ | { | ||||||||||||||||||||
|
Subroutine
build_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 16 | 18 | my($self) = shift; | |||||||||||||||||||||
| 17 | |||||||||||||||||||||||
| 18 | 18 | $self->add_fields | |||||||||||||||||||||
| 19 | ( | ||||||||||||||||||||||
| 20 | date => 'datetime split mdy', | ||||||||||||||||||||||
| 21 | time => 'time split hms', | ||||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||
| 24 | |||||||||||||||||||||||
| 25 | sub decompose_value | ||||||||||||||||||||||
| 26 | 163 | ▶ | { | ||||||||||||||||||||
|
Subroutine
decompose_value: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||
| 27 | 163 | my($self, $value) = @_; | |||||||||||||||||||||
| 28 | |||||||||||||||||||||||
| 29 | 163 | ▶ | return undef unless(defined $value); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 30 | |||||||||||||||||||||||
| 31 | 11 | my $date = $self->SUPER::inflate_value($value); | |||||||||||||||||||||
| 32 | |||||||||||||||||||||||
| 33 | 11 | ▶ | unless($date) | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||
| 35 | 5 | ▶ | no warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 36 | return | ||||||||||||||||||||||
| 37 | { | ||||||||||||||||||||||
| 38 | 4 | ▶ | date => substr($value, 0, 10) || '', | ||||||||||||||||||||
|
Condition75%3/4
substr($value, 0, 10) || ''
substr($value, 10) || ''
MC/DC0%0/1
substr($value, 0, 10) || ''
substr($value, 0, 10)
MC/DC100%1/1
substr($value, 10) || ''
substr($value, 10)
Truth table50%1/2
A
A= substr($value, 0, 10)
Truth table100%2/2
A
A= substr($value, 10)
| |||||||||||||||||||||||
| 39 | time => substr($value, 10) || '', | ||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||
| 42 | |||||||||||||||||||||||
| 43 | 7 | my($mdy, $time) = Rose::DateTime::Util::format_date($date, '%m/%d/%Y', '%I:%M:%S %p'); | |||||||||||||||||||||
| 44 | |||||||||||||||||||||||
| 45 | return | ||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||
| 47 | 7 | date => $mdy, | |||||||||||||||||||||
| 48 | time => $time, | ||||||||||||||||||||||
| 49 | }; | ||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||
| 51 | |||||||||||||||||||||||
| 52 | sub coalesce_value | ||||||||||||||||||||||
| 53 | 7 | ▶ | { | ||||||||||||||||||||
|
Subroutine
coalesce_value: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||
| 54 | 7 | my($self) = shift; | |||||||||||||||||||||
| 55 | 14 | ▶ | return join(' ', map { defined($_) ? $_ : '' } | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 56 | 7 | map { $self->field($_)->output_value } qw(date time)); | |||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||
| 58 | |||||||||||||||||||||||
| 59 | sub is_full | ||||||||||||||||||||||
| 60 | 331 | ▶ | { | ||||||||||||||||||||
|
Subroutine
is_full: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||
| 61 | 331 | my($self) = shift; | |||||||||||||||||||||
| 62 | |||||||||||||||||||||||
| 63 | 662 | ▶ | my $count = grep { defined && length } | ||||||||||||||||||||
|
Condition100%3/3
defined $_ && length $_
MC/DC100%2/2
defined $_ && length $_
defined $_
length $_
Truth table100%3/3
A && B
A= defined $_B= length $_
| |||||||||||||||||||||||
| 64 | 331 | map { $self->field($_)->internal_value } qw(date time); | |||||||||||||||||||||
| 65 | |||||||||||||||||||||||
| 66 | 331 | ▶ | return $count == 2 ? 1 : 0; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||
| 68 | |||||||||||||||||||||||
| 69 | sub deflate_value | ||||||||||||||||||||||
| 70 | 2 | ▶ | { | ||||||||||||||||||||
|
Subroutine
deflate_value: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 71 | 2 | my($self, $date) = @_; | |||||||||||||||||||||
| 72 | 2 | ▶ | return $self->input_value_filtered unless($date); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 73 | 1 | return Rose::DateTime::Util::format_date($date, '%m/%d/%Y %I:%M:%S %p'); | |||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||
| 75 | |||||||||||||||||||||||
| 76 | sub html_field | ||||||||||||||||||||||
| 77 | 6 | ▶ | { | ||||||||||||||||||||
|
Subroutine
html_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 78 | 6 | my($self) = shift; | |||||||||||||||||||||
| 79 | |||||||||||||||||||||||
| 80 | 6 | return '<span class="datetime">' . | |||||||||||||||||||||
| 81 | $self->field('date')->html_field . ' ' . | ||||||||||||||||||||||
| 82 | $self->field('time')->html_field . | ||||||||||||||||||||||
| 83 | '</span>'; | ||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||
| 85 | |||||||||||||||||||||||
| 86 | sub xhtml_field | ||||||||||||||||||||||
| 87 | 2 | ▶ | { | ||||||||||||||||||||
|
Subroutine
xhtml_field: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 88 | 2 | my($self) = shift; | |||||||||||||||||||||
| 89 | |||||||||||||||||||||||
| 90 | 2 | return '<span class="datetime">' . | |||||||||||||||||||||
| 91 | $self->field('date')->xhtml_field . ' ' . | ||||||||||||||||||||||
| 92 | $self->field('time')->xhtml_field . | ||||||||||||||||||||||
| 93 | '</span>'; | ||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||
| 95 | |||||||||||||||||||||||
| 96 | 5 | 1; | |||||||||||||||||||||
| 97 | |||||||||||||||||||||||
| 98 | __END__ | ||||||||||||||||||||||