line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Flexconf::Json; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
18
|
use JSON::MaybeXS; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
692
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub parse { |
6
|
0
|
|
|
0
|
0
|
|
return decode_json shift; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub stringify { |
10
|
0
|
|
|
0
|
0
|
|
return encode_json shift; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub load { |
14
|
0
|
|
|
0
|
0
|
|
my ( $filepath ) = @_; |
15
|
0
|
|
|
|
|
|
local $/; |
16
|
0
|
0
|
|
|
|
|
open FH, "<", $filepath or return undef; |
17
|
0
|
|
|
|
|
|
my $conf = ; |
18
|
0
|
|
|
|
|
|
$conf = decode_json $conf; |
19
|
0
|
|
|
|
|
|
close FH; |
20
|
0
|
|
|
|
|
|
$conf; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub save { |
24
|
0
|
|
|
0
|
0
|
|
my ( $filepath, $conf ) = @_; |
25
|
0
|
0
|
|
|
|
|
open FH, ">", $filepath or die("Could not open file. $!"); |
26
|
0
|
|
|
|
|
|
print FH encode_json $conf; |
27
|
0
|
|
|
|
|
|
close FH; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|