1Declare::Constraints::SUismeprleC:o:nLtirDbierbcaulrtayer:de::AP:reCrroalnys(Dt3or)cauimnetnst:a:tSiiomnple::Library::Array(3)
2
3
4

NAME

6       Declare::Constraints::Simple::Library::Array - Array Constraints
7

SYNOPSIS

9         # accept a list of pairs
10         my $pairs_validation = IsArrayRef( HasArraySize(2,2) );
11
12         # integer => object pairs
13         my $pairs = And( OnEvenElements(IsInt),
14                          OnOddElements(IsObject) );
15
16         # a three element array
17         my $tri = And( HasArraySize(3,3),
18                        OnArrayElements(0, IsInt,
19                                        1, IsDefined,
20                                        2, IsClass) );
21

DESCRIPTION

23       This module contains all constraints that can be applied to array ref‐
24       erences.
25

CONSTRAINTS

27       HasArraySize([$min, [$max]])
28
29       With $min defaulting to 1. So a specification of
30
31         my $profile = HasArraySize;
32
33       checks for at least one value. To force an exact size of the array,
34       specify the same values for both:
35
36         my $profile = HasArraySize(3, 3);
37
38       OnArrayElements($key => $constraint, $key => $constraint, ...)
39
40       Applies the the $constraints to the corresponding $keys if they are
41       present. For required keys see "HasArraySize".
42
43       OnEvenElements($constraint)
44
45       Runs the constraint on all even elements of an array. See also "OnOd‐
46       dElements".
47
48       OnOddElements($constraint)
49
50       Runs the constraint on all odd elements of an array. See also
51       "OnEvenElements".
52

SEE ALSO

54       Declare::Constraints::Simple, Declare::Constraints::Simple::Library
55

AUTHOR

57       Robert 'phaylon' Sedlacek "<phaylon@dunkelheit.at>"
58
60       This module is free software, you can redistribute it and/or modify it
61       under the same terms as perl itself.
62
63
64
65perl v5.8.8                    Dec2l0a0r6e-:0:9C-o1n1straints::Simple::Library::Array(3)
Impressum