line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
3877
|
use 5.008008; |
|
3
|
|
|
|
|
10
|
|
2
|
3
|
|
|
3
|
|
12
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
51
|
|
3
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
146
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package portable::loader::JSON; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
16
|
use portable::lib; |
|
3
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
17
|
|
11
|
3
|
|
|
3
|
|
29
|
use portable::loader; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
536
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
3
|
|
|
3
|
0
|
6
|
my $me = shift; |
15
|
3
|
|
|
|
|
5
|
my ($loader) = @_; |
16
|
3
|
|
|
|
|
10
|
$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
|
|
|
|
|
|
|
|