1Data::FormValidator::CoUnssetrraCionnttsrFiabcuttoeDrdayt(Pa3e:)r:lFoDromcVuamleindtaattoiro:n:ConstraintsFactory(3)
2
3
4
6 Data::FormValidator::ConstraintsFactory - Module to create constraints
7 for HTML::FormValidator.
8
10 This module contains functions to help generate complex constraints.
11
12 If you are writing new code, take a look at
13 Data::FormValidator::Constraints::MethodsFactory instead. It's a modern
14 alternative to what's here, offering improved names and syntax.
15
17 use Data::FormValidator::ConstraintsFactory qw( :set :bool );
18
19 constraints => {
20 param1 => make_or_constraint(
21 make_num_set_constraint( -1, ( 1 .. 10 ) ),
22 make_set_constraint( 1, ( 20 .. 30 ) ),
23 ),
24 province => make_word_set_constraint( 1, "AB QC ON TN NU" ),
25 bid => make_range_constraint( 1, 1, 10 ),
26 }
27
29 Those constraints are available by using the ":bool" tag.
30
31 make_not_constraint( $c1 )
32 This will create a constraint that will return the negation of the
33 result of constraint $c1.
34
35 make_or_constraint( @constraints )
36 This will create a constraint that will return the result of the first
37 constraint that return an non false result.
38
39 make_and_constraint( @constraints )
40 This will create a constraint that will return the result of the first
41 constraint that return an non false result only if all constraints
42 returns a non-false results.
43
45 Those constraints are available by using the ":set" tag.
46
47 make_set_constraint( $res, @elements )
48 This will create a constraint that will return $res if the value is one
49 of the @elements set, or the negation of $res otherwise.
50
51 The "eq" operator is used for comparison.
52
53 make_num_set_constraint( $res, @elements )
54 This will create a constraint that will return $res if the value is one
55 of the @elements set, or the negation of $res otherwise.
56
57 The "==" operator is used for comparison.
58
59 make_word_set_constraint( $res, $set )
60 This will create a constraint that will return $res if the value is a
61 word in $set, or the negation of $res otherwise.
62
63 make_cmp_set_constraint( $res, $cmp, @elements )
64 This will create a constraint that will return $res if the value is one
65 of the @elements set, or the negation of $res otherwise.
66
67 $cmp is a function which takes two argument and should return true or
68 false depending if the two elements are equal.
69
71 Those constraints are available by using the ":num" tag.
72
73 make_clamp_constraint( $res, $low, $high )
74 This will create a constraint that will return $res if the value is
75 between $low and $high bounds included or its negation otherwise.
76
77 make_lt_constraint( $res, $bound )
78 This will create a constraint that will return $res if the value is
79 lower than $bound, or the negation of $res otherwise.
80
81 make_le_constraint( $res, $bound )
82 This will create a constraint that will return $res if the value is
83 lower or equal than $bound, or the negation of $res otherwise.
84
85 make_gt_constraint( $res, $bound )
86 This will create a constraint that will return $res if the value is
87 greater than $bound, or the negation of $res otherwise.
88
89 make_ge_constraint( $res, $bound )
90 This will create a constraint that will return $res if the value is
91 greater or equal than $bound, or the negation of $res otherwise.
92
94 make_length_constraint($max_length)
95 This will create a constraint that will return true if the value has a
96 length of less than or equal to $max_length
97
99 Data::FormValidator(3)
100
102 Author: Francis J. Lacoste <francis.lacoste@iNsu.COM> Maintainer: Mark
103 Stosberg <mark@summersault.com>
104
106 Copyright (c) 2000 iNsu Innovations Inc. All rights reserved.
107
108 This program is free software; you can redistribute it and/or modify it
109 under the terms as perl itself.
110
111
112
113perl v5.34.0 202D2a-t0a1:-:2F1ormValidator::ConstraintsFactory(3)