| 1 | package ZMQ::Declare::ZDCF::Encoder::JSON; | ||
| 2 | { | ||
| 3 | 1 | $ZMQ::Declare::ZDCF::Encoder::JSON::VERSION = '0.03'; | |
| 4 | } | ||
| 5 | 1 | ▶ | use 5.008001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | ▶ | use parent 'ZMQ::Declare::ZDCF::Encoder'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | ▶ | use JSON (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 1 | my $json = JSON->new; | |
| 13 | 1 | $json->utf8(1); | |
| 14 | 1 | $json->pretty(1); | |
| 15 | |||
| 16 | 3 | ▶ | sub encode { |
|
Subroutine
encode: called CC=1 SCAR=0.0
Pod
documented
| |||
| 17 | 3 | my $self = shift; | |
| 18 | 3 | return \($json->encode(shift)); | |
| 19 | } | ||
| 20 | |||
| 21 | 3 | ▶ | sub decode { |
|
Subroutine
decode: called CC=1 SCAR=0.0
Pod
documented
| |||
| 22 | 3 | my $self = shift; | |
| 23 | 3 | return $json->decode(${shift()}); | |
| 24 | } | ||
| 25 | |||
| 26 | 1 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | 1 | __PACKAGE__->meta->make_immutable; | |
| 28 | |||
| 29 | __END__ | ||