1Declare::Constraints::SUismeprleC:o:nLtDirebicrblauartryee:d:::SPCceoarnllsatrDr(oa3ci)unmtesn:t:aStiimopnle::Library::Scalar(3)
2
3
4
6 Declare::Constraints::Simple::Library::Scalar - Scalar Constraints
7
9 # match one of a set of regexes
10 my $some_regexes = Matches(qr/foo/, qr/bar/);
11
12 # allow only defined values
13 my $is_defined = IsDefined;
14
15 # between 5 and 50 chars
16 my $five_to_fifty = HasLength(5, 50);
17
18 # match against a set of values
19 my $command_constraint = IsOneOf(qw(create update delete));
20
21 # check for trueness
22 my $is_true = IsTrue;
23
24 # simple equality
25 my $is_foo = IsEq('foo');
26
28 This library contains all constraints to validate scalar values.
29
31 Matches(@regex)
32
33 my $c = Matches(qr/foo/, qr/bar/);
34
35 If one of the parameters matches the expression, this is true.
36
37 IsDefined()
38
39 True if the value is defined.
40
41 HasLength([$min, [$max]])
42
43 Is true if the value has a length above $min (which defaults to 1> and,
44 if supplied, under the value of $max. A simple
45
46 my $c = HasLength;
47
48 checks if the value has a length of at least 1.
49
50 IsOneOf(@values)
51
52 True if one of the @values equals the passed value. "undef" values work
53 with this too, so
54
55 my $c = IsOneOf(1, 2, undef);
56
57 will return true on an undefined value.
58
59 IsTrue()
60
61 True if the value evulates to true in boolean context.
62
63 IsEq($comparator)
64
65 Valid if the value is "eq" the $comparator.
66
68 Declare::Constraints::Simple, Declare::Constraints::Simple::Library
69
71 Robert 'phaylon' Sedlacek "<phaylon@dunkelheit.at>"
72
74 This module is free software, you can redistribute it and/or modify it
75 under the same terms as perl itself.
76
77
78
79perl v5.8.8 Decl2a0r0e6:-:0C9o-n1s1traints::Simple::Library::Scalar(3)