| 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
Condition33%1/3
%opts or $Data::Clean::FromJSON::creating_singleton
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
| |||||||||||||||||||||||||||||
| 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"]
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"}
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||