line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
3647
|
use 5.008008; |
|
3
|
|
|
|
|
8
|
|
2
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
51
|
|
3
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
128
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package portable::loader::JSON; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
16
|
use portable::lib; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
12
|
|
11
|
3
|
|
|
3
|
|
21
|
use portable::loader; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
547
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
3
|
|
|
3
|
0
|
6
|
my $me = shift; |
15
|
3
|
|
|
|
|
6
|
my ($loader) = @_; |
16
|
3
|
|
|
|
|
8
|
$loader->register_extension('portable.json'); |
17
|
3
|
|
|
|
|
6
|
return; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $decoder; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub parse { |
23
|
0
|
|
|
0
|
0
|
|
my $me = shift; |
24
|
0
|
|
|
|
|
|
my ($filename) = @_; |
25
|
0
|
|
|
|
|
|
require JSON::Eval; |
26
|
0
|
|
0
|
|
|
|
$decoder ||= JSON::Eval->new; |
27
|
0
|
|
|
|
|
|
my $jsontext = do { |
28
|
0
|
0
|
|
|
|
|
open my $fh, '<', $filename |
29
|
|
|
|
|
|
|
or die "Could not open $filename: $!"; |
30
|
0
|
|
|
|
|
|
local $/; |
31
|
0
|
|
|
|
|
|
<$fh>; |
32
|
|
|
|
|
|
|
}; |
33
|
0
|
|
|
|
|
|
return ($filename => $decoder->decode($jsontext)); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|