line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::RoutesAuthDBI::Util; |
2
|
1
|
|
|
1
|
|
7
|
use Mojo::Base -base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
176
|
use Exporter 'import'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
|
|
|
|
|
|
#~ use Mojo::JSON qw(decode_json encode_json); |
5
|
|
|
|
|
|
|
#~ use Encode qw(encode decode); |
6
|
1
|
|
|
1
|
|
461
|
use Mojo::Loader; |
|
1
|
|
|
|
|
37419
|
|
|
1
|
|
|
|
|
57
|
|
7
|
1
|
|
|
1
|
|
870
|
use JSON::PP; |
|
1
|
|
|
|
|
14564
|
|
|
1
|
|
|
|
|
383
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $JSON = JSON::PP->new->utf8(0); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw(json_enc json_dec load_class); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub json_enc { |
14
|
|
|
|
|
|
|
#~ decode('utf-8', encode_json(shift)); |
15
|
0
|
|
|
0
|
0
|
|
$JSON->encode(shift); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub json_dec { |
20
|
|
|
|
|
|
|
#~ decode_json(encode('utf-8', shift)); |
21
|
0
|
|
|
0
|
0
|
|
$JSON->decode(shift); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub load_class { |
25
|
0
|
|
|
0
|
0
|
|
my $class; |
26
|
0
|
0
|
0
|
|
|
|
if (@_ == 1 && ! ref $_[0]) {$class = shift} |
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
else { |
28
|
0
|
0
|
|
|
|
|
my $conf = ref $_[0] ? shift : {@_}; |
29
|
0
|
0
|
0
|
|
|
|
$class = join '::', $conf->{namespace} ? ($conf->{namespace}) : (), $conf->{module} || $conf->{controller} || $conf->{package}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
0
|
|
|
|
my $e; $e = Mojo::Loader::load_class($class)# success undef |
|
0
|
0
|
|
|
|
|
|
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; |