man Data::FormValidator::ConstraintsFactory () - Module to create constraints for HTML::FormValidator.

NAME

Data::FormValidator::ConstraintsFactory - Module to create constraints for HTML::FormValidator.

SYNOPSIS

    use Data::FormValidator::ConstraintsFactory qw( :set :bool );

    constraints => {
        param1 => make_or_constraint( 
                    make_num_set_constraint( -1, ( 1 .. 10 ) ),
                    make_set_constraint( 1, ( 20 .. 30 ) ),
                  ),
        province => make_word_set_constraint( "AB QC ON TN NU" ),
        bid      => make_range_constraint( 1, 1, 10 ),
    }

DESCRIPTION

This module contains several functions which returns closures that can be used for constraints.

BOOLEAN CONSTRAINTS

Those constraints are available by using the CW:bool tag. This will create a constraint that will return the negation of the result of constraint CW$c1. This will create a constraint that will return the result of the first constraint that return an non false result. This will create a constraint that will return the result of the first constraint that return an non false result only if all constraints returns a non-false results.

SET CONSTRAINTS

Those constraints are available by using the CW:set tag. This will create a constraint that will return CW$res if the value is one of the CW@elements set, or the negation of CW$res otherwise.

The CWeq operator is used for comparison. This will create a constraint that will return CW$res if the value is one of the CW@elements set, or the negation of CW$res otherwise.

The CW== operator is used for comparison. This will create a constraint that will return CW$res if the value is a word in CW$set, or the negation of CW$res otherwise. This will create a constraint that will return CW$res if the value is one of the CW@elements set, or the negation of CW$res otherwise.

$cmp is a function which takes two argument and should return true or false depending if the two elements are equal.

NUMERICAL LOGICAL CONSTRAINTS

Those constraints are available by using the CW:num tag. This will create a constraint that will return CW$res if the value is between CW$low and CW$high bounds included or its negation otherwise. This will create a constraint that will return CW$res if the value is lower than CW$bound, or the negation of CW$res otherwise. This will create a constraint that will return CW$res if the value is lower or equal than CW$bound, or the negation of CW$res otherwise. This will create a constraint that will return CW$res if the value is greater than CW$bound, or the negation of CW$res otherwise. This will create a constraint that will return CW$res if the value is greater or equal than CW$bound, or the negation of CW$res otherwise.

OTHER CONSTRAINTS

make_length_constraint($max_length)

This will create a constraint that will return true if the value has a length of less than or equal to CW$max_length

SEE ALSO

AUTHOR

Author: Francis J. Lacoste <francis.lacoste@iNsu.COM> Maintainer: Mark Stosberg <mark@summersault.com>

COPYRIGHT

Copyright (c) 2000 iNsu Innovations Inc. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms as perl itself.