ZMQ::Declare::ZDCF - Object representing ZeroMQ Device Configuration (File)
use ZMQ::Declare; my $zdcf = ZMQ::Declare::ZDCF->new(tree => $json_zdcf_filename); # Alternatively my $zdcf = ZMQ::Declare::ZDCF->new( encoder => ZMQ::Declare::ZDCF::Encoder::YourFormat->new, tree => $zdcf_file_with_different_encoding ); my $app = $zdcf->application("event_broker"); # ...
This class represents the content of a single ZDCF. That means, it covers a single 0MQ threading context and an arbitrary number of devices and sockets.
Constructor taking named arguments. Any parameters listed under METHOD-ACCESSIBLE INSTANCE PROPERTIES can be supplied, but a
tree is the main input and thus required.
You can provide the
tree property as any one of the following:
Given an application name, creates a ZMQ::Declare::Application object from the information stored in the ZDCF tree and returns that object.
ZMQ::Declare::Application object contains one 0MQ threading context and one or many 0MQ device objects. Those devise are what you can use to actually implement 0MQ devices that are configured through ZDCF. Note that creating a
ZMQ::Declare::Application object does not create any 0MQ contexts, sockets, or connections yet.
Returns a list (not a reference) of application names that are known to the ZDCF tree.
Encodes the ZDCF data structure using the object's encoder and returns a scalar reference to the result.
Writes the ZDCF content to the given file name.
The ZDCF RFC http://rfc.zeromq.org/spec:5
Get/set the validator object that can check a Perl-datastructure ZDCF tree for structural correctness. Must be a ZMQ::Declare::ZDCF::Validator object or an object of a derived class. Defaults to a new
Get/set the encoder (decoder) object for turning a text file into a ZDCF tree in memory and vice versa. Needs to be an object of a class derived from ZMQ::Declare::ZDCF::Encoder. Defaults to a ZMQ::Declare::ZDCF::Encoder::JSON object for reading/writing JSON-encoded ZDCF.
The actual nested (and untyped) Perl data structure that represents the ZDCF information. See the documentation for the constructor for details on what data is valid to supply to the constructor for this property.
Steffen Mueller <email@example.com>
Copyright (C) 2012 by Steffen Mueller
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.