NAME
Brannigan::Tree - A Brannigan validation/parsing scheme tree, possibly built from a series of inherited schemes.
VERSION
version 0.8
DESCRIPTION
This module is used internally by Brannigan. Basically, a tree is a validation/parsing scheme in its "final", workable structure, taking any inherited schemes into account. The actual validation and parsing of input is done by this module.
MODULES
new( $scheme | @schemes )
Creates a new Brannigan::Tree instance from one or more schemes.
process( \%params )
Validates and parses the hash-ref of input parameters. Returns a hash-ref of the parsed input, possibly containing a '_rejects' hash-ref with a list of failed validations for each failed parameter.
validate( \%params )
Validates the hash-ref of input parameters and returns a hash-ref of rejects (i.e. failed validation methods) for each parameter.
parse( \%params, \%param_rules, [\%group_rules] )
Receives a hash-ref of parameters, a hash-ref of parameter rules (this is the 'params' part of a scheme) and optionally a hash-ref of group rules (this is the 'groups' part of a scheme), parses the parameters according to these rules and returns a hash-ref of all the parameters after parsing.
INTERNAL METHODS
_validate_param( $param, $value, \%validations )
Receives the name of a parameter, its value, and a hash-ref of validations to assert against. Returns a list of validations that failed for this parameter. Depending on the type of the parameter (either scalar, hash or array), this method will call one of the following three methods.
_validate_scalar( $param, $value, \%validations, [$type] )
Receives the name of a parameter, its value, and a hash-ref of validations to assert against. Returns a list of all failed validations for this parameter. If the parameter is a child of a hash/array parameter, then $type
must be provided with either 'hash' or 'array'.
_validate_array( $param, $value, \%validations )
Receives the name of an array parameter, its value, and a hash-ref of validations to assert against. Returns a list of validations that failed for this parameter.
_validate_hash( $param, $value, \%validations )
Receives the name of a hash parameter, its value, and a hash-ref of validations to assert against. Returns a list of validations that failed for this parameter.
_merge_trees( @trees )
Merges two or more hash-refs of validation/parsing trees and returns the resulting tree. The merge is performed in order, so trees later in the array (i.e. on the right) "tramp" the trees on the left.
SEE ALSO
Brannigan, Brannigan::Validations.
AUTHOR
Ido Perlmuter, <ido at ido50 dot net>
BUGS
Please report any bugs or feature requests to bug-brannigan at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Brannigan. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Brannigan::Tree
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
LICENSE AND COPYRIGHT
Copyright 2010 Ido Perlmuter.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.