.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Data::FormValidator::ConstraintsFactory 3pm" .TH Data::FormValidator::ConstraintsFactory 3pm "2017-10-24" "perl v5.26.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Data::FormValidator::ConstraintsFactory \- Module to create constraints for HTML::FormValidator. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module contains functions to help generate complex constraints. .PP If you are writing new code, take a look at Data::FormValidator::Constraints::MethodsFactory instead. It's a modern alternative to what's here, offering improved names and syntax. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& 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( 1, "AB QC ON TN NU" ), \& bid => make_range_constraint( 1, 1, 10 ), \& } .Ve .SH "BOOLEAN CONSTRAINTS" .IX Header "BOOLEAN CONSTRAINTS" Those constraints are available by using the \f(CW\*(C`:bool\*(C'\fR tag. .ie n .SS "make_not_constraint( $c1 )" .el .SS "make_not_constraint( \f(CW$c1\fP )" .IX Subsection "make_not_constraint( $c1 )" This will create a constraint that will return the negation of the result of constraint \f(CW$c1\fR. .ie n .SS "make_or_constraint( @constraints )" .el .SS "make_or_constraint( \f(CW@constraints\fP )" .IX Subsection "make_or_constraint( @constraints )" This will create a constraint that will return the result of the first constraint that return an non false result. .ie n .SS "make_and_constraint( @constraints )" .el .SS "make_and_constraint( \f(CW@constraints\fP )" .IX Subsection "make_and_constraint( @constraints )" 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. .SH "SET CONSTRAINTS" .IX Header "SET CONSTRAINTS" Those constraints are available by using the \f(CW\*(C`:set\*(C'\fR tag. .ie n .SS "make_set_constraint( $res, @elements )" .el .SS "make_set_constraint( \f(CW$res\fP, \f(CW@elements\fP )" .IX Subsection "make_set_constraint( $res, @elements )" This will create a constraint that will return \f(CW$res\fR if the value is one of the \f(CW@elements\fR set, or the negation of \f(CW$res\fR otherwise. .PP The \f(CW\*(C`eq\*(C'\fR operator is used for comparison. .ie n .SS "make_num_set_constraint( $res, @elements )" .el .SS "make_num_set_constraint( \f(CW$res\fP, \f(CW@elements\fP )" .IX Subsection "make_num_set_constraint( $res, @elements )" This will create a constraint that will return \f(CW$res\fR if the value is one of the \f(CW@elements\fR set, or the negation of \f(CW$res\fR otherwise. .PP The \f(CW\*(C`==\*(C'\fR operator is used for comparison. .ie n .SS "make_word_set_constraint( $res, $set )" .el .SS "make_word_set_constraint( \f(CW$res\fP, \f(CW$set\fP )" .IX Subsection "make_word_set_constraint( $res, $set )" This will create a constraint that will return \f(CW$res\fR if the value is a word in \f(CW$set\fR, or the negation of \f(CW$res\fR otherwise. .ie n .SS "make_cmp_set_constraint( $res, $cmp, @elements )" .el .SS "make_cmp_set_constraint( \f(CW$res\fP, \f(CW$cmp\fP, \f(CW@elements\fP )" .IX Subsection "make_cmp_set_constraint( $res, $cmp, @elements )" This will create a constraint that will return \f(CW$res\fR if the value is one of the \f(CW@elements\fR set, or the negation of \f(CW$res\fR otherwise. .PP \&\f(CW$cmp\fR is a function which takes two argument and should return true or false depending if the two elements are equal. .SH "NUMERICAL LOGICAL CONSTRAINTS" .IX Header "NUMERICAL LOGICAL CONSTRAINTS" Those constraints are available by using the \f(CW\*(C`:num\*(C'\fR tag. .ie n .SS "make_clamp_constraint( $res, $low, $high )" .el .SS "make_clamp_constraint( \f(CW$res\fP, \f(CW$low\fP, \f(CW$high\fP )" .IX Subsection "make_clamp_constraint( $res, $low, $high )" This will create a constraint that will return \f(CW$res\fR if the value is between \f(CW$low\fR and \f(CW$high\fR bounds included or its negation otherwise. .ie n .SS "make_lt_constraint( $res, $bound )" .el .SS "make_lt_constraint( \f(CW$res\fP, \f(CW$bound\fP )" .IX Subsection "make_lt_constraint( $res, $bound )" This will create a constraint that will return \f(CW$res\fR if the value is lower than \f(CW$bound\fR, or the negation of \f(CW$res\fR otherwise. .ie n .SS "make_le_constraint( $res, $bound )" .el .SS "make_le_constraint( \f(CW$res\fP, \f(CW$bound\fP )" .IX Subsection "make_le_constraint( $res, $bound )" This will create a constraint that will return \f(CW$res\fR if the value is lower or equal than \f(CW$bound\fR, or the negation of \f(CW$res\fR otherwise. .ie n .SS "make_gt_constraint( $res, $bound )" .el .SS "make_gt_constraint( \f(CW$res\fP, \f(CW$bound\fP )" .IX Subsection "make_gt_constraint( $res, $bound )" This will create a constraint that will return \f(CW$res\fR if the value is greater than \f(CW$bound\fR, or the negation of \f(CW$res\fR otherwise. .ie n .SS "make_ge_constraint( $res, $bound )" .el .SS "make_ge_constraint( \f(CW$res\fP, \f(CW$bound\fP )" .IX Subsection "make_ge_constraint( $res, $bound )" This will create a constraint that will return \f(CW$res\fR if the value is greater or equal than \f(CW$bound\fR, or the negation of \f(CW$res\fR otherwise. .SH "OTHER CONSTRAINTS" .IX Header "OTHER CONSTRAINTS" .SS "make_length_constraint($max_length)" .IX Subsection "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 \f(CW$max_length\fR .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIData::FormValidator\fR\|(3) .SH "AUTHOR" .IX Header "AUTHOR" Author: Francis J. Lacoste Maintainer: Mark Stosberg .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2000 iNsu Innovations Inc. All rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the terms as perl itself.