| 1 | package Net::Respite::Common; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | Net::Respite::Common - Common methods used internally | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | package CustomModule; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | use base 'Net::Respite::Common'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | sub xkey1 { return shift->_configs->{xxx_key} || "unknown" } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | sub parse1 { return shift->json->decode(shift) } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 27 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 27 | my ($class, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 27 | ▶ | return bless {%{$args || {}}}, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args || {}
MC/DC100%1/1
$args || {}
$args
Truth table100%2/2
A
A= $args
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 11 | our $js; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 27 | ▶ | sub json { $js ||= eval { require JSON; JSON->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical } || die "Could not load JSON: $@" } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
json: called CC=3 SCAR=11.4
Pod
undocumented
Condition60%3/5
$Net::Respite::Common::js ||= eval {
do {
require JSON;
"JSON"->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical
}
} || die("Could not load JSON: $@")
eval {
do {
require JSON;
'JSON'->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical
}
} || die("Could not load JSON: $@")
MC/DC0%0/2
$Net::Respite::Common::js ||= eval {
do {
require JSON;
"JSON"->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical
}
} || die("Could not load JSON: $@")
$Net::Respite::Common::js
eval {
do {
require JSON;
'JSON'->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical
}
}
Truth table66%2/3
A ||= B
A= $Net::Respite::Common::jsB= eval {
do {
require JSON;
'JSON'->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 11 | our $jp; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub jsop { $jp ||= eval { require JSON; JSON->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical->pretty } || die "Could not load JSON: $@" } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
jsop: not called CC=3 SCAR=24.8
Pod
undocumented
Condition0%0/5
$Net::Respite::Common::jp ||= eval {
do {
require JSON;
"JSON"->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical->pretty
}
} || die("Could not load JSON: $@")
eval {
do {
require JSON;
'JSON'->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical->pretty
}
} || die("Could not load JSON: $@")
MC/DC0%0/2
$Net::Respite::Common::jp ||= eval {
do {
require JSON;
"JSON"->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical->pretty
}
} || die("Could not load JSON: $@")
$Net::Respite::Common::jp
eval {
do {
require JSON;
'JSON'->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical->pretty
}
}
Truth table0%0/3
A ||= B
A= $Net::Respite::Common::jpB= eval {
do {
require JSON;
'JSON'->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical->pretty
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 11 | our $config; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 182 | ▶ | sub _configs { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_configs: called CC=9 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 182 | ▶ | return $config ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$Net::Respite::Common::config ||= do {
my $c = undef;
eval {
do {
require config;
eval {
do {
$c = "config"->load
}
};
$c ||= defined $config::config && "HASH" eq ref $config::config && $config::config;
$c ||= %config::config ? \%config::config : undef
}
};
"HASH" eq ref $c or $c = {"failed_load", $@ || "missing config::config hash"};
$c
}
MC/DC0%0/2
$Net::Respite::Common::config ||= do {
my $c = undef;
eval {
do {
require config;
eval {
do {
$c = "config"->load
}
};
$c ||= defined $config::config && "HASH" eq ref $config::config && $config::config;
$c ||= %config::config ? \%config::config : undef
}
};
"HASH" eq ref $c or $c = {"failed_load", $@ || "missing config::config hash"};
$c
}
$Net::Respite::Common::config
do {
my $c = undef;
eval {
do {
require config;
eval {
do {
$c = "config"->load
}
};
$c ||= defined $config::config && "HASH" eq ref $config::config && $config::config;
$c ||= %config::config ? \%config::config : undef
}
};
"HASH" eq ref $c or $c = {"failed_load", $@ || "missing config::config hash"};
$c
}
Truth table66%2/3
A ||= B
A= $Net::Respite::Common::configB= do {
my $c = undef;
eval {
do {
require config;
eval {
do {
$c = "config"->load
}
};
$c ||= defined $config::config && "HASH" eq ref $config::config && $config::config;
$c ||= %config::config ? \%config::config : undef
}
};
"HASH" eq ref $c or $c = {"failed_load", $@ || "missing config::config hash"};
$c
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 8 | my $c = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 8 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 8 | require config; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 7 | eval { $c = config->load }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 7 | ▶ | $c ||= defined($config::config) && "HASH" eq ref $config::config && $config::config; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition77%7/9
$c ||= defined $config::config && "HASH" eq ref $config::config && $config::config
defined $config::config && 'HASH' eq ref $config::config && $config::config
defined $config::config and "HASH" eq ref $config::config
MC/DC0%0/4
$c ||= defined $config::config && "HASH" eq ref $config::config && $config::config
$c
defined $config::config
"HASH" eq ref $config::config
$config::config
Truth table0%0/5
A ||= B and C && D
A= $cB= defined $config::configC= "HASH" eq ref $config::configD= $config::config
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 7 | ▶ | $c ||= %config::config ? \%config::config : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$c ||= %config::config ? \%config::config : undef
MC/DC100%2/2
$c ||= %config::config ? \%config::config : undef
$c
%config::config ? \%config::config : undef
Truth table100%3/3
A ||= B
A= $cB= %config::config ? \%config::config : undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 8 | ▶ | "HASH" eq ref $c or $c = { failed_load => ($@ || "missing config::config hash") }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$@ || 'missing config::config hash'
MC/DC100%1/1
$@ || 'missing config::config hash'
$@
Truth table100%2/2
A
A= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 8 | $c; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||