NAME

ZMQ::Declare::ZDCF::Validator - ZDCF validator

SYNOPSIS

use ZMQ::Declare;
my $validator = ZMQ::Declare::ZDCF::Validator->new;
unless ($validator->validate($datastructure)) {
  die "Input data structure is not ZDCF!"
}

DESCRIPTION

Validates that a given nested Perl data structure (arrays, hashes, scalars) is actually a valid ZDCF tree.

METHODS

validate

Returns true if the given Perl data structure is a valid ZDCF tree, false otherwise.

Dies if the specification version of the ZDCF tree is unsupported.

The second parameter to this method can optionally be a major ZDCF specification version to use for validation instead of auto-detection.

validate_and_upgrade

Validates the input ZDCF structure, then attempts to upgrade it to the newest supported spec version. Returns a cloned copy of the input structure on success or undef on failure.

upgrade_structure

Given a ZDCF structure, determines the specification version and tries to upgrade it to the most recent supported version.

Does not validate the input and works in-place.

find_spec_version

Returns the version of the provided specification.

Returns undef on failure.

SEE ALSO

The ZDCF RFC http://rfc.zeromq.org/spec:17

Data::Rx, http://rx.codesimply.com/index.html

ZeroMQ

AUTHOR

Steffen Mueller <smueller@cpan.org>

COPYRIGHT AND LICENSE

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.