line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Catmandu::Sane; |
3
|
6
|
|
|
6
|
|
1053
|
|
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
38
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.2019'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
6
|
|
|
6
|
|
37
|
use Catmandu::Util qw(is_value); |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
32
|
|
8
|
6
|
|
|
6
|
|
1830
|
use Catmandu::Util::Regex qw(as_regex); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
348
|
|
9
|
6
|
|
|
6
|
|
2194
|
use namespace::clean; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
342
|
|
10
|
6
|
|
|
6
|
|
45
|
use Catmandu::Fix::Has; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
36
|
|
11
|
6
|
|
|
6
|
|
1604
|
|
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
36
|
|
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
|
|
100
|
sub { |
20
|
11
|
|
|
|
|
63
|
my $v = $_[0]; |
21
|
|
|
|
|
|
|
is_value($v) && $v =~ $re; |
22
|
33
|
|
|
33
|
|
53
|
}; |
23
|
33
|
50
|
|
|
|
636
|
} |
24
|
11
|
|
|
|
|
58
|
|
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 |