loader/JSON.pm

filter: Statementstmt 70.9% 22 / 31 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 2 totaltotal 59.5% 28 / 47 CC 3 SCAR 15.4
CC
3
Cov
61%
parse
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.7
↑ Summary loader.pm »
1 3 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package portable::loader::JSON;
6  
7 3 our $AUTHORITY = 'cpan:TOBYINK';
8 3 our $VERSION = '0.003';
9  
10 3 ▶use portable::lib;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use portable::loader;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
14 3 my $me = shift;
15 3 my ($loader) = @_;
16 3 $loader->register_extension('portable.json');
17 3 return;
18 }
19  
20 3 our $decoder;
21  
22 0 ▶sub parse {
Subroutine parse: not called CC=3 SCAR=24.8
Pod undocumented
23 0 my $me = shift;
24 0 my ($filename) = @_;
25 0 require JSON::Eval;
26 0 ▶ $decoder ||= JSON::Eval->new;
Condition0%0/3
$portable::loader::JSON::decoder ||= "JSON::Eval"->new
l!l&&r!l&&!r
000
MC/DC0%0/2
$portable::loader::JSON::decoder ||= "JSON::Eval"->new
$portable::loader::JSON::decoder "JSON::Eval"->new
Truth table0%0/3
A ||= B
A= $portable::loader::JSON::decoderB= "JSON::Eval"->new
ABresult
1X1
011
000
27 0 my $jsontext = do {
28 0 ▶ open my $fh, '<', $filename
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $filename or die "Could not open ${filename}: $!" 0 0 0
29 or die "Could not open $filename: $!";
30 0 local $/;
31 0 <$fh>;
32 };
33 0 return ($filename => $decoder->decode($jsontext));
34 }
35  
36 3 1;
37  
↑ Summary loader.pm »