line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
1084
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
1
|
|
|
1
|
|
6
|
use Catmandu::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
374
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
9
|
1
|
|
|
1
|
|
354
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
10
|
1
|
|
|
1
|
|
306
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Fix::Bind', 'Catmandu::Fix::Bind::Group'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has start => (fix_opt => 1); |
14
|
|
|
|
|
|
|
has end => (fix_opt => 1); |
15
|
|
|
|
|
|
|
has step => (fix_opt => 1); |
16
|
|
|
|
|
|
|
has var => (fix_opt => 1); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my ($self, $data) = @_; |
19
|
|
|
|
|
|
|
$data; |
20
|
29
|
|
|
29
|
0
|
91
|
} |
21
|
29
|
|
|
|
|
415
|
|
22
|
|
|
|
|
|
|
my ($self, $mvar, $func, $name, $fixer) = @_; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $start = $self->start; |
25
|
|
|
|
|
|
|
my $end = $self->end; |
26
|
|
|
|
|
|
|
my $step = $self->step // 1; |
27
|
|
|
|
|
|
|
my $var = $self->var; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
if ( Catmandu::Util::is_number($start) |
30
|
|
|
|
|
|
|
&& Catmandu::Util::is_number($end) |
31
|
|
|
|
|
|
|
&& Catmandu::Util::is_number($step)) |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
for (my $i = $start; $i <= $end; $i = $i + $step) { |
34
|
|
|
|
|
|
|
$mvar->{$var} = $i if defined($var); |
35
|
|
|
|
|
|
|
$mvar = $func->($mvar); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
delete $mvar->{$var} if defined($var); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return $mvar; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=pod |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Catmandu::Fix::Bind::iterate - a binder iterates fixes in a loop |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SYNOPSIS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Create: |
57
|
|
|
|
|
|
|
# numbers = [1,2,3,4,5,6,7,8,9,10] |
58
|
|
|
|
|
|
|
do iterate(start:1, end: 10, step: 1, var: i) |
59
|
|
|
|
|
|
|
copy_field(i,numbers.$append) |
60
|
|
|
|
|
|
|
end |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRIPTION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The list binder will iterate over all the elements in a list and fixes the |
65
|
|
|
|
|
|
|
values in context of that list. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 CONFIGURATION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 start |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Start value of the iterator. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 end |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
End value of the iterator. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 step |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Increase the interator with this value for every step. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head3 var |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Optional variable holding the value of the current step |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SEE ALSO |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
L<Catmandu::Fix::Bind> , |
88
|
|
|
|
|
|
|
L<Catmandu::Fix::list> , |
89
|
|
|
|
|
|
|
L<Catmandu::Fix::with> , |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |