| 1 | package Mojolicious::Plugin::RoutesAuthDBI::Util; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Mojo::Base -base; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | #~ use Mojo::JSON qw(decode_json encode_json); | ||||||||||||||||||||||||||||||||||||||||||
| 5 | #~ use Encode qw(encode decode); | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Mojo::Loader; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use JSON::PP; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | my $JSON = JSON::PP->new->utf8(0); | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | our @EXPORT_OK = qw(json_enc json_dec load_class); | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub json_enc { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
json_enc: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | #~ decode('utf-8', encode_json(shift)); | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | $JSON->encode(shift); | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub json_dec { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
json_dec: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | #~ decode_json(encode('utf-8', shift)); | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | $JSON->decode(shift); | |||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub load_class { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_class: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | my $class; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if (@_ == 1 && ! ref $_[0]) {$class = shift} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ == 1 and not ref $_[0]
MC/DC0%0/2
@_ == 1 and not ref $_[0]
@_ == 1
not ref $_[0]
Truth table0%0/3
A and not(B)
A= @_ == 1B= not ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | my $conf = ref $_[0] ? shift : {@_}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | $class = join '::', $conf->{namespace} ? ($conf->{namespace}) : (), $conf->{module} || $conf->{controller} || $conf->{package}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$conf->{'module'} || $conf->{'controller'} || $conf->{'package'}
$conf->{"module"} or $conf->{"controller"}
MC/DC0%0/3
$conf->{'module'} || $conf->{'controller'} || $conf->{'package'}
$conf->{"module"}
$conf->{"controller"}
$conf->{'package'}
Truth table0%0/4
A or B || C
A= $conf->{"module"}B= $conf->{"controller"}C= $conf->{'package'}
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my $e; $e = Mojo::Loader::load_class($class)# success undef | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$e = Mojo::Loader::load_class($class) and $e eq 1 ? 1 : warn("None load_class[$class]: ", $e)
MC/DC0%0/2
$e = Mojo::Loader::load_class($class) and $e eq 1 ? 1 : warn("None load_class[$class]: ", $e)
$e = Mojo::Loader::load_class($class)
$e eq 1 ? 1 : warn("None load_class[$class]: ", $e)
Truth table0%0/3
A and B
A= $e = Mojo::Loader::load_class($class)B= $e eq 1 ? 1 : warn("None load_class[$class]: ", $e)
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | and ($e eq 1 ? 1 : warn("None load_class[$class]: ", $e)) # warn("Class [$class] not found ", sprintf("[%s] [%s] [%s]", caller)) | ||||||||||||||||||||||||||||||||||||||||||
| 35 | and return undef; | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | return $class; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||