| 1 | package Catmandu::Fix::Bind::iterate; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Catmandu::Sane; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | our $VERSION = '1.2025'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Catmandu::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Catmandu::Fix::Has; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | with 'Catmandu::Fix::Bind', 'Catmandu::Fix::Bind::Group'; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | has start => (fix_opt => 1); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | has end => (fix_opt => 1); | |||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | has step => (fix_opt => 1); | |||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | has var => (fix_opt => 1); | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 29 | ▶ | sub unit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unit: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 29 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 29 | $data; | |||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 29 | ▶ | sub bind { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bind: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 29 | my ($self, $mvar, $func, $name, $fixer) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 29 | my $start = $self->start; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 29 | my $end = $self->end; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 29 | ▶ | my $step = $self->step // 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->step // 1
MC/DC0%0/1
$self->step // 1
$self->step
Truth table50%1/2
A
A= $self->step
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 29 | my $var = $self->var; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 29 | ▶ | if ( Catmandu::Util::is_number($start) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
Catmandu::Util::is_number($start) and Catmandu::Util::is_number($end) and Catmandu::Util::is_number($step)
Catmandu::Util::is_number($start) and Catmandu::Util::is_number($end)
MC/DC33%1/3
Catmandu::Util::is_number($start) and Catmandu::Util::is_number($end) and Catmandu::Util::is_number($step)
Catmandu::Util::is_number($start)
Catmandu::Util::is_number($end)
Catmandu::Util::is_number($step)
Truth table50%2/4
A and B and C
A= Catmandu::Util::is_number($start)B= Catmandu::Util::is_number($end)C= Catmandu::Util::is_number($step)
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | && Catmandu::Util::is_number($end) | ||||||||||||||||||||||||||||||||||||||||||
| 34 | && Catmandu::Util::is_number($step)) | ||||||||||||||||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 28 | ▶ | for (my $i = $start; $i <= $end; $i = $i + $step) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 145 | ▶ | $mvar->{$var} = $i if defined($var); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 145 | $mvar = $func->($mvar); | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 28 | ▶ | delete $mvar->{$var} if defined($var); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 28 | return $mvar; | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | __END__ | ||||||||||||||||||||||||||||||||||||||||||