line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
85012
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
1
|
|
|
1
|
|
6
|
use List::Util qw(all); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
274
|
use Catmandu::Fix; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
48
|
|
9
|
1
|
|
|
1
|
|
432
|
use Catmandu::Util qw(is_string is_array_ref); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
10
|
1
|
|
|
1
|
|
6
|
use Catmandu::Util::Path qw(as_path); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
11
|
1
|
|
|
1
|
|
342
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
12
|
1
|
|
|
1
|
|
5
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
13
|
1
|
|
|
1
|
|
610
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
14
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with 'Catmandu::Fix::Builder'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my ($self) = @_; |
19
|
|
|
|
|
|
|
my $getter = as_path($self->path)->getter; |
20
|
5
|
|
|
5
|
|
36
|
sub { |
21
|
5
|
|
|
|
|
53
|
my $data = $_[0]; |
22
|
|
|
|
|
|
|
for my $fixes (@{$getter->($data)}) { |
23
|
5
|
|
|
5
|
|
9
|
$fixes = [$fixes] unless is_array_ref($fixes); |
24
|
5
|
|
|
|
|
5
|
next unless @$fixes && all {is_string($_)} @$fixes; |
|
5
|
|
|
|
|
70
|
|
25
|
4
|
100
|
|
|
|
13
|
my $fixer = Catmandu::Fix->new(fixes => $fixes); |
26
|
4
|
100
|
66
|
|
|
22
|
$data = $fixer->fix($data); |
|
5
|
|
|
|
|
18
|
|
27
|
3
|
|
|
|
|
55
|
} |
28
|
3
|
|
|
|
|
54
|
$data; |
29
|
|
|
|
|
|
|
}; |
30
|
5
|
|
|
|
|
80
|
} |
31
|
5
|
|
|
|
|
56
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Catmandu::Fix::eval - eval and execute fixes defined in a field |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# {fixes => 'add_field(foo,bar)'} |
44
|
|
|
|
|
|
|
eval(fixes) |
45
|
|
|
|
|
|
|
# {fixes => 'add_field(foo,bar)', foo => 'bar'} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# {fixes => ['add_field(foo,bar)','upcase(foo)'], foo => 'bar'} |
48
|
|
|
|
|
|
|
eval(fixes) |
49
|
|
|
|
|
|
|
# {fixes => ['add_field(foo,bar)','upcase(foo)'], foo => 'BAR'} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SEE ALSO |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
L<Catmandu::Fix> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |