line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Serialize::Serializer::JSON::MaybeXS; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
#ABSTRACT: JSON::MaybeXS serializer for File::Serialize |
4
|
|
|
|
|
|
|
$File::Serialize::Serializer::JSON::MaybeXS::VERSION = '1.5.0'; |
5
|
6
|
|
|
6
|
|
4886
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
159
|
|
6
|
6
|
|
|
6
|
|
27
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
147
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
514
|
use Moo; |
|
6
|
|
|
|
|
7979
|
|
|
6
|
|
|
|
|
31
|
|
9
|
|
|
|
|
|
|
with 'File::Serialize::Serializer'; |
10
|
|
|
|
|
|
|
|
11
|
56
|
|
|
56
|
1
|
187
|
sub extensions { qw/ json js / }; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub serialize { |
14
|
|
|
|
|
|
|
my( $self, $data, $options ) = @_; |
15
|
|
|
|
|
|
|
JSON::MaybeXS->new(%$options)->encode( $data); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub deserialize { |
19
|
|
|
|
|
|
|
my( $self, $data, $options ) = @_; |
20
|
|
|
|
|
|
|
JSON::MaybeXS->new(%$options)->decode( $data); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub groom_options { |
24
|
37
|
|
|
37
|
0
|
78
|
my( $self, $options ) = @_; |
25
|
|
|
|
|
|
|
|
26
|
37
|
|
|
|
|
60
|
my %groomed; |
27
|
37
|
|
|
|
|
76
|
for my $k( qw/ pretty canonical allow_nonref / ) { |
28
|
111
|
100
|
|
|
|
313
|
$groomed{$k} = $options->{$k} if defined $options->{$k}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
37
|
|
|
|
|
111
|
return \%groomed; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |