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
24       references.
25

CONSTRAINTS

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

SEE ALSO

50       Declare::Constraints::Simple, Declare::Constraints::Simple::Library
51

AUTHOR

53       Robert 'phaylon' Sedlacek "<phaylon@dunkelheit.at>"
54
56       This module is free software, you can redistribute it and/or modify it
57       under the same terms as perl itself.
58
59
60
61perl v5.32.1                   Dec2l0a2r1e-:0:1C-o2n7straints::Simple::Library::Array(3)
Impressum