FromJSON.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 50.0% 1 / 2 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 82.2% 37 / 45 CC 4 SCAR 9.8
CC
4
Cov
85%
new
5.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« ForJSON.pm ↑ Summary
1 package Data::Clean::FromJSON;
2  
3 2 our $DATE = '2019-11-26'; # DATE
4 2 our $VERSION = '0.395'; # VERSION
5  
6 2 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use parent qw(Data::Clean);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use vars qw($creating_singleton);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶sub new {
Subroutine new: called CC=4 SCAR=16.4
Pod documented
14 1 my ($class, %opts) = @_;
15 1 ▶ if (!%opts && !$creating_singleton) {
Branch: 1 branch
BranchTrueFalseTotal
unless (%opts or $Data::Clean::FromJSON::creating_singleton) 0 1 1
Condition33%1/3
%opts or $Data::Clean::FromJSON::creating_singleton
l!l&&r!l&&!r
010
MC/DC0%0/2
%opts or $Data::Clean::FromJSON::creating_singleton
%opts $Data::Clean::FromJSON::creating_singleton
Truth table33%1/3
A or B
A= %optsB= $Data::Clean::FromJSON::creating_singleton
ABresult
1X1
011
000
16 0 warn "You are creating a new ".__PACKAGE__." object without customizing options. ".
17 "You probably want to call get_cleanser() yet to get a singleton instead?";
18 }
19  
20 1 ▶ $opts{"JSON::PP::Boolean"} //= ['deref_scalar_one_or_zero'];
Condition50%1/2
$opts{"JSON::PP::Boolean"} //= ["deref_scalar_one_or_zero"]
l!l
01
MC/DC0%0/1
$opts{"JSON::PP::Boolean"} //= ["deref_scalar_one_or_zero"]
$opts{"JSON::PP::Boolean"}
Truth table50%1/2
A
A= $opts{"JSON::PP::Boolean"}
Aresult
11
00
21  
22 1 $class->SUPER::new(%opts);
23 }
24  
25 1 ▶sub get_cleanser {
Subroutine get_cleanser: called CC=1 SCAR=0.0
Pod documented
26 1 my $class = shift;
27 1 local $creating_singleton = 1;
28 1 state $singleton = $class->new;
29 1 $singleton;
30 }
31  
32 2 1;
33 # ABSTRACT: Clean data from JSON decoder
34  
35 __END__
« ForJSON.pm ↑ Summary