line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
6
|
|
|
6
|
|
1009
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
46
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2018'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
6
|
|
|
6
|
|
42
|
use Catmandu::Util qw(is_value); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
37
|
|
8
|
6
|
|
|
6
|
|
2047
|
use Catmandu::Util::Regex qw(as_regex); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
369
|
|
9
|
6
|
|
|
6
|
|
2393
|
use namespace::clean; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
328
|
|
10
|
6
|
|
|
6
|
|
38
|
use Catmandu::Fix::Has; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
45
|
|
11
|
6
|
|
|
6
|
|
1769
|
|
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
49
|
|
12
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
13
|
|
|
|
|
|
|
has pattern => (fix_arg => 1); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Catmandu::Fix::Condition::Builder::Simple'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
my $re = as_regex($self->pattern); |
19
|
11
|
|
|
11
|
|
111
|
sub { |
20
|
11
|
|
|
|
|
81
|
my $v = $_[0]; |
21
|
|
|
|
|
|
|
is_value($v) && $v =~ $re; |
22
|
33
|
|
|
33
|
|
54
|
}; |
23
|
33
|
50
|
|
|
|
664
|
} |
24
|
11
|
|
|
|
|
74
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Catmandu::Fix::Condition::all_match - only execute fixes if all path values match the given regex |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# uppercase the value of field 'foo' if all members of 'oogly' have the value 'doogly' |
37
|
|
|
|
|
|
|
if all_match(oogly.*, "doogly") |
38
|
|
|
|
|
|
|
upcase(foo) # foo => 'BAR' |
39
|
|
|
|
|
|
|
end |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# case insensitive search for 'doogly' in all 'oogly' |
42
|
|
|
|
|
|
|
if all_match(oogly.*, "(?i)doogly") |
43
|
|
|
|
|
|
|
... |
44
|
|
|
|
|
|
|
end |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SEE ALSO |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
L<Catmandu::Fix> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |