line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Condition::any_match; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
759
|
use Catmandu::Sane; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
12
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.2020'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
14
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
15
|
|
8
|
2
|
|
|
2
|
|
711
|
use namespace::clean; |
|
2
|
|
|
|
|
26
|
|
|
2
|
|
|
|
|
13
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'Catmandu::Fix::Condition::all_match'; |
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
40
|
sub _build_mode {'any'} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
1; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
__END__ |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=pod |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 NAME |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Catmandu::Fix::Condition::any_match - only execute fixes if any path value matches the given regex |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# uppercase the value of field 'foo' if at least one member of 'oogly' has the value 'doogly' |
27
|
|
|
|
|
|
|
if any_match(oogly, "doogly") |
28
|
|
|
|
|
|
|
upcase(foo) # foo => 'BAR' |
29
|
|
|
|
|
|
|
end |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# case insensitive search for 'doogly' in 'oogly' fields |
32
|
|
|
|
|
|
|
if any_match(oogly.*, "(?i)doogly") |
33
|
|
|
|
|
|
|
... |
34
|
|
|
|
|
|
|
end |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SEE ALSO |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
L<Catmandu::Fix> |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |