line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebAPI::DBIC::Role::JsonEncoder; |
2
|
|
|
|
|
|
|
$WebAPI::DBIC::Role::JsonEncoder::VERSION = '0.004001'; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
18130031
|
use JSON::MaybeXS qw(JSON); |
|
2
|
|
|
|
|
1849
|
|
|
2
|
|
|
|
|
174
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
981
|
use Moo::Role; |
|
2
|
|
|
|
|
42771
|
|
|
2
|
|
|
|
|
12
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has _json_encoder => ( |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
builder => '_build_json_encoder', |
12
|
|
|
|
|
|
|
handles => { |
13
|
|
|
|
|
|
|
encode_json => 'encode', |
14
|
|
|
|
|
|
|
decode_json => 'decode', |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _build_json_encoder { |
19
|
0
|
|
|
0
|
|
|
my $codec = JSON->new->ascii; |
20
|
0
|
0
|
|
|
|
|
$codec->canonical->pretty if $ENV{WEBAPI_DBIC_DEBUG}; |
21
|
0
|
|
|
|
|
|
return $codec; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=encoding UTF-8 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
WebAPI::DBIC::Role::JsonEncoder |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 VERSION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
version 0.004001 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
WebAPI::DBIC::Resource::Role::JsonEncoder - provides encode_json and decode_json methods |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 AUTHOR |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Tim Bunce <Tim.Bunce@pobox.com> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Tim Bunce. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
53
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |