| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catmandu::Serializer::json_string; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
108220
|
use Catmandu::Sane; |
|
|
1
|
|
|
|
|
197115
|
|
|
|
1
|
|
|
|
|
7
|
|
|
4
|
1
|
|
|
1
|
|
1135
|
use JSON qw(); |
|
|
1
|
|
|
|
|
8734
|
|
|
|
1
|
|
|
|
|
27
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use Moo; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has json => ( |
|
8
|
|
|
|
|
|
|
is => "ro", |
|
9
|
|
|
|
|
|
|
lazy => 1, |
|
10
|
|
|
|
|
|
|
init_arg => undef, |
|
11
|
|
|
|
|
|
|
default => sub {JSON->new()->utf8(0);} |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub serialize { |
|
15
|
1
|
|
|
1
|
0
|
2298
|
$_[0]->json()->encode($_[1]); |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub deserialize { |
|
19
|
1
|
|
|
1
|
0
|
1423
|
$_[0]->json()->decode($_[1]); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
__END__ |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=pod |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Catmandu::Serializer - A (de)serializer from and to json strings |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
serializer 'json' returns a binary utf-8 string, |
|
35
|
|
|
|
|
|
|
which only makes sense if you send your data to column of type 'binary' |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
use this serializer if your data column is a text field or a subtype of text |
|
38
|
|
|
|
|
|
|
(like json or jsonb in postgres) |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
L<Catmandu::Serializer> |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |