line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Haineko::JSON; |
2
|
12
|
|
|
12
|
|
7231
|
use feature ':5.10'; |
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
1530
|
|
3
|
12
|
|
|
12
|
|
69
|
use strict; |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
1295
|
|
4
|
12
|
|
|
12
|
|
66
|
use warnings; |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
370
|
|
5
|
12
|
|
|
12
|
|
67
|
use Carp; |
|
12
|
|
|
|
|
35
|
|
|
12
|
|
|
|
|
969
|
|
6
|
12
|
|
|
12
|
|
2474
|
use IO::File; |
|
12
|
|
|
|
|
26389
|
|
|
12
|
|
|
|
|
3045
|
|
7
|
12
|
|
|
12
|
|
33671
|
use JSON::Syck; |
|
12
|
|
|
|
|
83749
|
|
|
12
|
|
|
|
|
4185
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub loadfile { |
10
|
35
|
|
|
35
|
1
|
3621
|
my $class = shift; |
11
|
35
|
|
100
|
|
|
142
|
my $argvs = shift // return undef; |
12
|
|
|
|
|
|
|
|
13
|
34
|
100
|
|
|
|
648
|
return undef unless -f -r -s $argvs; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
33
|
|
|
13
|
my $filehandle = IO::File->new( $argvs, 'r' ) || croak $!; |
16
|
1
|
|
|
|
|
151
|
my $jsonstring = do { local $/; <$filehandle> }; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2542
|
|
17
|
1
|
|
|
|
|
73
|
$filehandle->close; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
368
|
return JSON::Syck::Load( $jsonstring ); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
0
|
0
|
0
|
sub dumpfile { |
23
|
|
|
|
|
|
|
# Not implemented yet |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub loadjson { |
27
|
16
|
|
|
16
|
1
|
45611
|
my $class = shift; |
28
|
16
|
|
100
|
|
|
87
|
my $argvs = shift // return undef;; |
29
|
|
|
|
|
|
|
|
30
|
15
|
|
|
|
|
1090
|
return JSON::Syck::Load( $argvs ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub dumpjson { |
34
|
17
|
|
|
17
|
1
|
11732
|
my $class = shift; |
35
|
17
|
|
50
|
|
|
60
|
my $argvs = shift // return undef; |
36
|
|
|
|
|
|
|
|
37
|
17
|
|
|
|
|
2349
|
return JSON::Syck::Dump( $argvs ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
__END__ |