Catmandu/Fix/Condition/Builder.pm

filter: Statementstmt 97.2% 35 / 36 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 1 totaltotal 94.1% 48 / 51 CC 3 SCAR 3.1
CC
3
Cov
95%
__ANON__
2.1
import
2.0
BEGIN
1.0
CRAP 1.4
« Catmandu/Importer/Text.pm ↑ Summary Catmandu/Fix/error.pm »
1 package Catmandu::Fix::Condition::Builder;
2  
3 32 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 32 our $VERSION = '1.2025';
6  
7 32 ▶use Clone qw(clone);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 32 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 32 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 32 with 'Catmandu::Fix::Base';
12  
13 109 ▶has pass_fixes => (is => 'rw', default => sub {[]});
Subroutine __ANON__: called CC=1 SCAR=0.0
14 109 ▶has fail_fixes => (is => 'rw', default => sub {[]});
Subroutine __ANON__: called CC=1 SCAR=0.0
15 32 has tester => (is => 'lazy');
16  
17 145 ▶sub emit {
Subroutine emit: called CC=1 SCAR=0.0
Pod undocumented
18 145 my ($self, $fixer) = @_;
19 145 my $sub_var = $fixer->capture($self->tester);
20 145 $self->_emit_branch(
21 $self->_emit_call($sub_var, $fixer->var),
22 $fixer->emit_fixes($self->pass_fixes),
23 $fixer->emit_fixes($self->fail_fixes),
24 );
25 }
26  
27 18 ▶sub import {
Subroutine import: called CC=2 SCAR=7.0
28 18 my $target = caller;
29 18 my ($fix, %opts) = @_;
30  
31 18 ▶ if (my $sym = $opts{as}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $sym = $opts{"as"}) 1 17 18
32 2 ▶ my $sub = sub {
Subroutine __ANON__: called CC=2 SCAR=7.6
33 2 my $data = shift;
34 2 ▶ if ($opts{clone}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts{"clone"}) 0 2 2
35 0 $data = clone($data);
36 }
37 2 $fix->new(@_)->tester->($data);
38 1 };
39 32 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 *{"${target}::$sym"} = $sub;
41 }
42 }
43  
44 32 1;
45  
46 __END__
« Catmandu/Importer/Text.pm ↑ Summary Catmandu/Fix/error.pm »