1Validation::Class::DireUcsteirveC:o:nOtprtiibountse(d3V)PaelrildaDtoicounm:e:nCtlaatsiso:n:Directive::Options(3)
2
3
4

NAME

6       Validation::Class::Directive::Options - Options Directive for
7       Validation Class Field Definitions
8

VERSION

10       version 7.900057
11

SYNOPSIS

13           use Validation::Class::Simple;
14
15           my $rules = Validation::Class::Simple->new(
16               fields => {
17                   user_role => {
18                       options => 'Client'
19                   }
20               }
21           );
22
23           # set parameters to be validated
24           $rules->params->add($parameters);
25
26           # validate
27           unless ($rules->validate) {
28               # handle the failures
29           }
30

DESCRIPTION

32       Validation::Class::Directive::Options is a core validation class field
33       directive that holds an enumerated list of values to be validated
34       against the associated parameters.
35
36       •       alternative argument: an-array-of-user-defined-options
37
38               This directive can be passed a single value or an array of
39               values:
40
41                   fields => {
42                       user_role => {
43                           options => ['Client', 'Employee', 'Administrator']
44                       }
45                   }
46
47                   # the following examples are useful for plugins (and other code)
48                   # that may want to otherwise identify option values
49
50                   fields => {
51                       user_role => {
52                           options => [
53                               '1|Client',
54                               '2|Employee',
55                               '3|Administrator'
56                           ]
57                       }
58                   }
59
60                   # please note:
61                   # declaring options as "keyed-options" will cause the validation of
62                   # the option's key and NOT the option's value
63
64                   fields => {
65                       user_role => {
66                           options => [
67                               [ 1 => 'Client' ],
68                               [ 2 => 'Employee' ],
69                               [ 3 => 'Administrator' ]
70                           ]
71                       }
72                   }
73

AUTHOR

75       Al Newkirk <anewkirk@ana.io>
76
78       This software is copyright (c) 2011 by Al Newkirk.
79
80       This is free software; you can redistribute it and/or modify it under
81       the same terms as the Perl 5 programming language system itself.
82
83
84
85perl v5.32.1                      2021-V0a1l-i2d7ation::Class::Directive::Options(3)
Impressum