line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ZMQ::Declare::ZDCF::Encoder::JSON; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$ZMQ::Declare::ZDCF::Encoder::JSON::VERSION = '0.03'; |
4
|
|
|
|
|
|
|
} |
5
|
1
|
|
|
1
|
|
30065
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
6
|
1
|
|
|
1
|
|
2595
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use parent 'ZMQ::Declare::ZDCF::Encoder'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use JSON (); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $json = JSON->new; |
13
|
|
|
|
|
|
|
$json->utf8(1); |
14
|
|
|
|
|
|
|
$json->pretty(1); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub encode { |
17
|
|
|
|
|
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
return \($json->encode(shift)); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub decode { |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
return $json->decode(${shift()}); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
no Moose; |
27
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
ZMQ::Declare::ZDCF::Encoder::JSON - ZDCF JSON encoder |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SYNOPSIS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
use ZMQ::Declare; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Inherits from |
42
|
|
|
|
|
|
|
L<ZMQ::Declare::ZDCF::Encoder>. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Implements a JSON encoder/decoder. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SEE ALSO |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
The ZDCF RFC L<http://rfc.zeromq.org/spec:5> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L<ZMQ::Declare::ZDCF> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
L<ZMQ::Declare::ZDCF::Encoder> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
L<ZeroMQ> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHOR |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Steffen Mueller E<lt>smueller@cpan.orgE<gt> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Copyright (C) 2012 by Steffen Mueller |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
65
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.1 or, |
66
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |