line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
17
|
|
|
17
|
|
2727
|
|
|
17
|
|
|
|
|
34
|
|
|
17
|
|
|
|
|
124
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
17
|
|
|
17
|
|
113
|
use Catmandu::Util::Path qw(as_path); |
|
17
|
|
|
|
|
36
|
|
|
17
|
|
|
|
|
111
|
|
8
|
17
|
|
|
17
|
|
6129
|
use namespace::clean; |
|
17
|
|
|
|
|
37
|
|
|
17
|
|
|
|
|
904
|
|
9
|
17
|
|
|
17
|
|
113
|
use Catmandu::Fix::Has; |
|
17
|
|
|
|
|
46
|
|
|
17
|
|
|
|
|
111
|
|
10
|
17
|
|
|
17
|
|
6077
|
|
|
17
|
|
|
|
|
39
|
|
|
17
|
|
|
|
|
134
|
|
11
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Catmandu::Fix::Condition::Builder'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my ($self) = @_; |
16
|
|
|
|
|
|
|
my $getter = as_path($self->path)->getter; |
17
|
44
|
|
|
44
|
|
434
|
sub { |
18
|
44
|
|
|
|
|
264
|
@{$getter->($_[0])} ? 1 : 0; |
19
|
|
|
|
|
|
|
}; |
20
|
78
|
100
|
|
78
|
|
115
|
} |
|
78
|
|
|
|
|
1121
|
|
21
|
44
|
|
|
|
|
357
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=pod |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Catmandu::Fix::Condition::exists - only execute fixes if the path exists |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# uppercase the value of field 'foo' if the field 'oogly' exists |
34
|
|
|
|
|
|
|
if exists(oogly) |
35
|
|
|
|
|
|
|
upcase(foo) # foo => 'BAR' |
36
|
|
|
|
|
|
|
end |
37
|
|
|
|
|
|
|
# inverted |
38
|
|
|
|
|
|
|
unless exists(oogly) |
39
|
|
|
|
|
|
|
upcase(foo) # foo => 'bar' |
40
|
|
|
|
|
|
|
end |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SEE ALSO |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
L<Catmandu::Fix> |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |