line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
1
|
|
|
1
|
|
86642
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
1
|
|
|
1
|
|
7
|
use List::Util qw(all); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
293
|
use Catmandu::Fix; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
9
|
1
|
|
|
1
|
|
495
|
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
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
56
|
|
11
|
1
|
|
|
1
|
|
412
|
use namespace::clean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
12
|
1
|
|
|
1
|
|
6
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
13
|
1
|
|
|
1
|
|
628
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
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
|
|
38
|
sub { |
21
|
5
|
|
|
|
|
46
|
my $data = $_[0]; |
22
|
|
|
|
|
|
|
for my $fixes (@{$getter->($data)}) { |
23
|
5
|
|
|
5
|
|
6
|
$fixes = [$fixes] unless is_array_ref($fixes); |
24
|
5
|
|
|
|
|
7
|
next unless @$fixes && all {is_string($_)} @$fixes; |
|
5
|
|
|
|
|
72
|
|
25
|
4
|
100
|
|
|
|
11
|
my $fixer = Catmandu::Fix->new(fixes => $fixes); |
26
|
4
|
100
|
66
|
|
|
25
|
$data = $fixer->fix($data); |
|
5
|
|
|
|
|
18
|
|
27
|
3
|
|
|
|
|
54
|
} |
28
|
3
|
|
|
|
|
52
|
$data; |
29
|
|
|
|
|
|
|
}; |
30
|
5
|
|
|
|
|
87
|
} |
31
|
5
|
|
|
|
|
44
|
|
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 |