Catmandu/Fix/perlcode.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 89.1% 33 / 37 CC 2 SCAR 2.6
CC
2
Cov
96%
_build_code
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Catmandu/Importer/Multi.pm ↑ Summary Catmandu/Logger.pm »
1 package Catmandu::Fix::perlcode;
2  
3 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.2025';
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 with 'Catmandu::Fix::Base';
12  
13 1 our %CACHE;
14  
15 1 has file => (fix_arg => 1);
16  
17 has code => (
18 is => 'lazy',
19 3 ▶ builder => sub {
Subroutine _build_code: called CC=2 SCAR=7.1
20 3 my $file = $_[0]->file;
21 3 ▶ $CACHE{$file} //= do $_[0]->file;
Condition66%2/3
$Catmandu::Fix::perlcode::CACHE{$file} //= do $_[0]->file
l!l&&r!l&&!r
210
MC/DC0%0/2
$Catmandu::Fix::perlcode::CACHE{$file} //= do $_[0]->file
$Catmandu::Fix::perlcode::CACHE{$file} do $_[0]->file
Truth table66%2/3
A //= B
A= $Catmandu::Fix::perlcode::CACHE{$file}B= do $_[0]->file
ABresult
1X1
011
000
22 }
23 1 );
24  
25 3 ▶sub emit {
Subroutine emit: called CC=1 SCAR=0.0
Pod undocumented
26 3 my ($self, $fixer) = @_;
27  
28 3 my $code = $fixer->capture($self->code);
29 3 my $var = $fixer->var;
30 3 my $reject = $fixer->capture({});
31  
32 3 "if (${code}->(${var},${reject}) == ${reject}) {"
33 . $fixer->emit_reject . "}";
34 }
35  
36 1 1;
37  
38 __END__
« Catmandu/Importer/Multi.pm ↑ Summary Catmandu/Logger.pm »