The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::TreeValidator::Sugar - Syntatic sugar for easily creating tree validators

DESCRIPTION

This module exports a few helper functions which allow you to build up a validation tree in a declarative manner.

All methods below are available for import into calling modules.

METHODS

branch { children... }

Create a Data::TreeValidator::Branch object, with children. Children are specified in a code ref, that should return a hash (not a reference) of all children as <name, node> pairs.

leaf

Constructs a Data::TreeValidator::Leaf object. All parameters passed are passed through to the Leaf constructor.

repeating { children... }

Just like "branch" in Data::TreeValidator::Sugar, but creates a Data::TreeValidator::RepeatingBranch instead of a standard branch.

AUTHOR

Oliver Charles

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Oliver Charles <oliver.g.charles@googlemail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.