blib/lib/Catmandu/Fix/filter.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/in.pm ↑ Summary blib/lib/Catmandu/IdGenerator/UUID.pm »
1 package Catmandu::Fix::filter;
2  
3 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.0201_02';
6  
7 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 has path => (fix_arg => 1);
12 1 has search => (fix_arg => 1);
13  
14 1 with 'Catmandu::Fix::SimpleGetValue';
15  
16 sub emit_value {
17 3 ▶ my ($self, $var, $fixer) = @_;
Subroutine emit_value: called CC=1 SCAR=0.0
Pod undocumented
18  
19 3 "if (is_array_ref(${var})) {"
20 . "${var} = [ grep { "
21 . $fixer->emit_match($self->search)
22 . " } \@{${var}} ];" . "}";
23 }
24  
25 1 1;
26  
27 __END__
28  
29 =pod
30  
31 =head1 NAME
32  
33 Catmandu::Fix::filter - Filter values out of an array based on a regular expression
34  
35 =head1 SYNOPSIS
36  
37 # words => ["Patrick","Nicolas","Paul","Frank"]
38
39 filter(words,'Pa')
40
41 # words => ["Patrick","Paul"]
42  
43 =head1 SEE ALSO
44  
45 L<Catmandu::Fix>
46  
47 =cut
« blib/lib/Catmandu/Fix/Condition/in.pm ↑ Summary blib/lib/Catmandu/IdGenerator/UUID.pm »