line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Serializer::JSON; |
2
|
11
|
|
|
11
|
|
579
|
BEGIN { @Data::Serializer::JSON::ISA = qw(Data::Serializer) } |
3
|
|
|
|
|
|
|
|
4
|
11
|
|
|
11
|
|
79
|
use warnings; |
|
11
|
|
|
|
|
28
|
|
|
11
|
|
|
|
|
345
|
|
5
|
11
|
|
|
11
|
|
60
|
use strict; |
|
11
|
|
|
|
|
23
|
|
|
11
|
|
|
|
|
295
|
|
6
|
11
|
|
|
11
|
|
65
|
use JSON; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
99
|
|
7
|
11
|
|
|
11
|
|
2161
|
use vars qw($VERSION @ISA); |
|
11
|
|
|
|
|
80
|
|
|
11
|
|
|
|
|
2307
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.04'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub serialize { |
12
|
147
|
50
|
|
147
|
1
|
3737
|
return JSON->VERSION < 2 ? JSON->new->objToJson($_[1]) : JSON->new->utf8->encode($_[1]); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub deserialize { |
16
|
|
|
|
|
|
|
#return JSON->VERSION < 2 ? JSON->new->jsonToObj($_[1]) : JSON->new->decode($_[1]); |
17
|
147
|
50
|
|
147
|
1
|
3783
|
$_[1] and return JSON->VERSION < 2 ? JSON->new->jsonToObj($_[1]) : JSON->new->utf8->decode($_[1]); |
|
|
50
|
|
|
|
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
__END__ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Data::Serializer::JSON - Creates bridge between Data::Serializer and JSON |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use Data::Serializer::JSON; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Module is used internally to Data::Serializer |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=over 4 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item B<serialize> - Wrapper to normalize serializer method name |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item B<deserialize> - Wrapper to normalize deserializer method name |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=back |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 AUTHOR |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Naoya Ito <naoya@bloghackers.net> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Patch to JSON 2 by Makamaka <makamaka@donzoko.net> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 COPYRIGHT |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This program is free software; you can redistribute it |
55
|
|
|
|
|
|
|
and/or modify it under the same terms as Perl itself. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SEE ALSO |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
perl(1), Data::Serializer(3), JSON(3). |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|