blib/lib/Catmandu/Fix/Condition/any_match.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 96.0% 24 / 25 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Catmandu/Fix/Condition/all_match.pm ↑ Summary blib/lib/Catmandu/Fix/Condition/in.pm »
1 package Catmandu::Fix::Condition::any_match;
2  
3 2 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 our $VERSION = '1.0201_02';
6  
7 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 has path => (fix_arg => 1);
12 2 has pattern => (fix_arg => 1);
13  
14 2 with 'Catmandu::Fix::Condition::SimpleAnyTest';
15  
16 sub emit_test {
17 3 ▶ my ($self, $var, $parser) = @_;
Subroutine emit_test: called CC=1 SCAR=0.0
Pod undocumented
18 3 "is_value(${var}) && ${var} =~ " . $parser->emit_match($self->pattern);
19 }
20  
21 2 1;
22  
23 __END__
24  
25 =pod
26  
27 =head1 NAME
28  
29 Catmandu::Fix::Condition::any_match - only execute fixes if any path value matches the given regex
30  
31 =head1 SYNOPSIS
32  
33 # uppercase the value of field 'foo' if field 'oogly' has the value 'doogly'
34 if any_match(oogly, "doogly")
35 upcase(foo) # foo => 'BAR'
36 end
37  
38 =head1 SEE ALSO
39  
40 L<Catmandu::Fix>
41  
42 =cut
« blib/lib/Catmandu/Fix/Condition/all_match.pm ↑ Summary blib/lib/Catmandu/Fix/Condition/in.pm »