line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
1
|
|
|
1
|
|
146721
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package MarpaX::ESLIF::ECMA404; |
6
|
1
|
|
|
1
|
|
476
|
use Log::Any qw/$log/; |
|
1
|
|
|
|
|
8384
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
2602
|
use MarpaX::ESLIF 3.0.32; |
|
1
|
|
|
|
|
158924
|
|
|
1
|
|
|
|
|
242
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $ESLIF = MarpaX::ESLIF->new($log); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: JSON Data Interchange Format following ECMA-404 specification |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.013'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JDDPAUSE'; # AUTHORITY |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub decode { |
20
|
354
|
|
|
354
|
1
|
4063720
|
my ($self, $input, %options) = @_; |
21
|
|
|
|
|
|
|
|
22
|
354
|
50
|
|
|
|
1301
|
return $options{strict} ? _JSONStrict()->decode($input, %options) : _JSONRelaxed()->decode($input, %options) |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub encode { |
27
|
0
|
|
|
0
|
1
|
0
|
my ($self, $input, %options) = @_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
0
|
return $options{strict} ? _JSONStrict()->encode($input, %options) : _JSONRelaxed()->encode($input, %options) |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# ------------- |
33
|
|
|
|
|
|
|
# Private stubs |
34
|
|
|
|
|
|
|
# ------------- |
35
|
|
|
|
|
|
|
sub _JSONStrict { |
36
|
354
|
|
|
354
|
|
600
|
CORE::state $JSONStrict = MarpaX::ESLIF::JSON->new($ESLIF, 1); |
37
|
|
|
|
|
|
|
|
38
|
354
|
|
|
|
|
43426
|
return $JSONStrict |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _JSONRelaxed { |
42
|
0
|
|
|
0
|
|
|
CORE::state $JSONRelaxed = MarpaX::ESLIF::JSON->new($ESLIF, 0); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return $JSONRelaxed |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |