blib/lib/Catmandu/Fix/Condition/all_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/upcase.pm ↑ Summary blib/lib/Catmandu/Fix/Condition/any_match.pm »
1 package Catmandu::Fix::Condition::all_match;
2  
3 4 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 4 our $VERSION = '1.0201_02';
6  
7 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 has path => (fix_arg => 1);
12 4 has pattern => (fix_arg => 1);
13  
14 4 with 'Catmandu::Fix::Condition::SimpleAllTest';
15  
16 sub emit_test {
17 8 ▶ my ($self, $var, $parser) = @_;
Subroutine emit_test: called CC=1 SCAR=0.0
Pod undocumented
18 8 "is_value(${var}) && ${var} =~ " . $parser->emit_match($self->pattern);
19 }
20  
21 4 1;
22  
23 __END__
24  
25 =pod
26  
27 =head1 NAME
28  
29 Catmandu::Fix::Condition::all_match - only execute fixes if all path values match the given regex
30  
31 =head1 SYNOPSIS
32  
33 # uppercase the value of field 'foo' if all members of 'oogly' have the value 'doogly'
34 if all_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/upcase.pm ↑ Summary blib/lib/Catmandu/Fix/Condition/any_match.pm »