er::JSON;
{
$ZMQ::Declare::ZDCF::Encoder::JSON::VERSION = '0.03';
}
use 5.008001;
use Moose;
use parent 'ZMQ::Declare::ZDCF::Encoder';
use JSON ();
my $json = JSON->new;
$json->utf8(1);
$json->pr
$json->encode(shift));
}
sub decode {
my $self = shift;
return $json->decode(${shift()});
}
no Moose;
__PACKAGE__->meta->make_immutable;
__END__
=head1 NAME
ZMQ::Declare::ZDCF::Encoder::JSON
- ZDCF JSON encoder
=head1 SYNOPSIS
use ZMQ::Declare;
=head1 DESCRIPTION
Inherits from
L<ZMQ::Declare::ZDCF::Encoder>.
Implements a JSON encoder/decoder.
=head1 SEE ALSO
The ZDCF RFC L<http:
::Declare::ZDCF::Encoder>.
Implements an encoder/decoder using Data::Dumper and eval.
Prefer the JSON encoder unless you have no choice -- this one can execute
arbitrary input code thanks to the eval
ERSION = '0.03';
}
use 5.008001;
use strict;
use warnings;
use Moose::Util::TypeConstraints;
use JSON ();
use ZeroMQ::Constants qw(:all);
my %zdcf_socket_types = (
pub => ZMQ_PUB,
sub => ZMQ_SUB
ZMQ::Declare::ZDCF::Validator;
use ZMQ::Declare::ZDCF::Encoder;
use ZMQ::Declare::ZDCF::Encoder::JSON;
use ZeroMQ qw(:all);
use ZMQ::Declare::Constants qw(:all);
use ZMQ::Declare::Types;
use Carp (
s => 'rw',
isa => 'ZMQ::Declare::ZDCF::Encoder',
default => sub {ZMQ::Declare::ZDCF::Encoder::JSON->new},
);
has 'tree' => (
is => 'rw',
required => 1,
);
sub BUILD {
my $self = shift;
m
ion (File)
=head1 SYNOPSIS
use ZMQ::Declare;
my $zdcf = ZMQ::Declare::ZDCF->new(tree => $json_zdcf_filename);
# Alternatively
my $zdcf = ZMQ::Declare::ZDCF->new(
encoder => ZMQ::Decla
N
Inherits from
L<ZMQ::Declare::ZDCF::Encoder>.
Implements a Storable encoder/decoder. Use the JSON encoder instead unless
you absolutely require Storable.
=head1 SEE ALSO
The ZDCF RFC L<http://r
rg/spec:5>
L<ZMQ::Declare::ZDCF>
L<ZMQ::Declare::ZDCF::Encoder>,
L<ZMQ::Declare::ZDCF::Encoder::JSON>
L<ZeroMQ>
=head1 AUTHOR
Steffen Mueller E<lt>smueller@cpan.orgE<gt>
=head1 COPYRIGHT AND LIC
re::ZDCF>
class which represents a single such configuration. The default
decoder/encoder assumes JSON input/output, but is pluggable.
The envisioned typical use of C<ZMQ::Declare> is that you write