| 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
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
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||