line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
17
|
|
|
17
|
|
2763
|
|
|
17
|
|
|
|
|
41
|
|
|
17
|
|
|
|
|
122
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
17
|
|
|
17
|
|
112
|
use Catmandu::Util::Path qw(as_path); |
|
17
|
|
|
|
|
44
|
|
|
17
|
|
|
|
|
94
|
|
8
|
17
|
|
|
17
|
|
5981
|
use namespace::clean; |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
960
|
|
9
|
17
|
|
|
17
|
|
101
|
use Catmandu::Fix::Has; |
|
17
|
|
|
|
|
31
|
|
|
17
|
|
|
|
|
112
|
|
10
|
17
|
|
|
17
|
|
6139
|
|
|
17
|
|
|
|
|
40
|
|
|
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
|
|
418
|
sub { |
18
|
44
|
|
|
|
|
197
|
@{$getter->($_[0])} ? 1 : 0; |
19
|
|
|
|
|
|
|
}; |
20
|
78
|
100
|
|
78
|
|
109
|
} |
|
78
|
|
|
|
|
1154
|
|
21
|
44
|
|
|
|
|
334
|
|
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 |