| 1 | package DateTimeX::Lite; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use overload ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | fallback => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | '<=>' => '_compare_overload', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 'cmp' => '_compare_overload', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | '""' => '_stringify_overload', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 'eq' => '_string_equals_overload', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 'ne' => '_string_not_equals_overload', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 9 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 39 | ▶ | sub _stringify_overload { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_stringify_overload: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 39 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 39 | ▶ | return $self->iso8601 unless $self->{formatter}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | return $self->{formatter}->format_datetime($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | sub _compare_overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 901 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_compare_overload: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # note: $_[1]->compare( $_[0] ) is an error when $_[1] is not a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # DateTime (such as the INFINITY value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 901 | ▶ | return $_[2] ? - $_[0]->compare( $_[1] ) : $_[0]->compare( $_[1] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 4 | ▶ | sub _string_equals_overload { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_string_equals_overload: called CC=7 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 4 | ▶ | my ( $class, $dt1, $dt2 ) = ref $_[0] ? ( undef, @_ ) : @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | return unless( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | ▶ | blessed $dt1 && $dt1->can('utc_rd_values') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
builtin::blessed($dt1) and $dt1->can("utc_rd_values") and builtin::blessed($dt2) and $dt2->can("utc_rd_values")
builtin::blessed($dt1) and $dt1->can("utc_rd_values") and builtin::blessed($dt2)
builtin::blessed($dt1) and $dt1->can("utc_rd_values")
MC/DC25%1/4
builtin::blessed($dt1) and $dt1->can("utc_rd_values") and builtin::blessed($dt2) and $dt2->can("utc_rd_values")
builtin::blessed($dt1)
$dt1->can("utc_rd_values")
builtin::blessed($dt2)
$dt2->can("utc_rd_values")
Truth table40%2/5
A and B and C and D
A= builtin::blessed($dt1)B= $dt1->can("utc_rd_values")C= builtin::blessed($dt2)D= $dt2->can("utc_rd_values")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | blessed $dt2 && $dt2->can('utc_rd_values') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | ▶ | $class ||= ref $dt1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$class ||= ref $dt1
MC/DC0%0/2
$class ||= ref $dt1
$class
ref $dt1
Truth table33%1/3
A ||= B
A= $classB= ref $dt1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | return ! $class->compare( $dt1, $dt2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | ▶ | sub _string_not_equals_overload { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_string_not_equals_overload: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | return ! _string_equals_overload(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||