lib/Catmandu/Fix/Condition/mab_match.pm

filter: Statementstmt 100% 39 / 39 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 97.9% 47 / 48 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Catmandu/Importer/SRU/Parser/mabxml.pm ↑ Summary
1 package Catmandu::Fix::Condition::mab_match;
2  
3 1 our $VERSION = '0.24';
4  
5 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Catmandu::Fix::mab_map;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Catmandu::Fix::Condition::all_match;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Catmandu::Fix::set_field;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Catmandu::Fix::remove_field;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 with 'Catmandu::Fix::Condition';
14  
15 1 has mab_path => ( fix_arg => 1 );
16 1 has value => ( fix_arg => 1 );
17  
18 1 ▶sub emit {
Subroutine emit: called CC=1 SCAR=0.0
Pod undocumented
19 1 my ( $self, $fixer, $label ) = @_;
20  
21 1 my $perl;
22  
23 1 my $tmp_var = '_tmp_' . int( rand(9999) );
24 1 my $mab_map
25 = Catmandu::Fix::mab_map->new( $self->mab_path, "$tmp_var.\$append" );
26 1 $perl .= $mab_map->emit( $fixer, $label );
27  
28 1 my $all_match = Catmandu::Fix::Condition::all_match->new( "$tmp_var.*",
29 $self->value );
30 1 my $remove_field = Catmandu::Fix::remove_field->new($tmp_var);
31  
32 1 my $pass_fixes = $self->pass_fixes;
33 1 my $fail_fixes = $self->fail_fixes;
34  
35 1 $all_match->pass_fixes( [ $remove_field, @$pass_fixes ] );
36 1 $all_match->fail_fixes( [ $remove_field, @$fail_fixes ] );
37  
38 1 $perl .= $all_match->emit( $fixer, $label );
39  
40 1 $perl;
41 }
42  
43  
44 1 1;
45  
46 __END__
« lib/Catmandu/Importer/SRU/Parser/mabxml.pm ↑ Summary