| 1 | package Cron::Toolkit::Pattern::Range; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use parent 'Cron::Toolkit::Pattern'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 21 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 7 | 21 | my ($class, %args) = @_; | |||||||||||||||||||||||||||
| 8 | 21 | my $self = $class->SUPER::new(%args); | |||||||||||||||||||||||||||
| 9 | 21 | ▶ | $self->{wrapped} = $args{wrapped} // 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
$args{"wrapped"} // 0
MC/DC100%1/1
$args{"wrapped"} // 0
$args{"wrapped"}
Truth table100%2/2
A
A= $args{"wrapped"}
| |||||||||||||||||||||||||||||
| 10 | 21 | return $self; | |||||||||||||||||||||||||||
| 11 | } | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1618 | ▶ | sub type { | ||||||||||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 1618 | return 'range'; | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1045 | ▶ | sub match { | ||||||||||||||||||||||||||
|
Subroutine
match: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 1045 | my ($self, $value, $tm) = @_; | |||||||||||||||||||||||||||
| 19 | 1045 | my $min = $self->{children}[0]{value}; | |||||||||||||||||||||||||||
| 20 | 1045 | my $max = $self->{children}[1]{value}; | |||||||||||||||||||||||||||
| 21 | 1045 | ▶ | if ($self->field_type eq 'dow' && $self->{wrapped}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->field_type eq "dow" and $self->{"wrapped"}
MC/DC100%2/2
$self->field_type eq "dow" and $self->{"wrapped"}
$self->field_type eq "dow"
$self->{"wrapped"}
Truth table100%3/3
A and B
A= $self->field_type eq "dow"B= $self->{"wrapped"}
| |||||||||||||||||||||||||||||
| 22 | # Wrapped range: e.g. 6-2 = 6,7,1,2 | ||||||||||||||||||||||||||||
| 23 | 21 | ▶ | return $value >= $min || $value <= $max; | ||||||||||||||||||||||||||
|
Condition100%3/3
$value >= $min || $value <= $max
MC/DC100%2/2
$value >= $min || $value <= $max
$value >= $min
$value <= $max
Truth table100%3/3
A || B
A= $value >= $minB= $value <= $max
| |||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | 1024 | ▶ | return $value >= $min && $value <= $max; | ||||||||||||||||||||||||||
|
Condition100%3/3
$value >= $min && $value <= $max
MC/DC100%2/2
$value >= $min && $value <= $max
$value >= $min
$value <= $max
Truth table100%3/3
A && B
A= $value >= $minB= $value <= $max
| |||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 17 | ▶ | sub to_english { | ||||||||||||||||||||||||||
|
Subroutine
to_english: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 17 | my ($self) = @_; | |||||||||||||||||||||||||||
| 30 | 17 | my $from = $self->{children}[0]->english_value; | |||||||||||||||||||||||||||
| 31 | 17 | my $to = $self->{children}[1]->english_value; | |||||||||||||||||||||||||||
| 32 | 17 | return "every " . $self->english_unit . " from $from to $to"; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 2 | 1; | |||||||||||||||||||||||||||