1Validation::Class::DireUcsteirveC:o:nFtirlitbeurtse(d3V)PaelrildaDtoicounm:e:nCtlaatsiso:n:Directive::Filters(3)
2
3
4
6 Validation::Class::Directive::Filters - Filters Directive for
7 Validation Class Field Definitions
8
10 version 7.900057
11
13 use Validation::Class::Simple;
14
15 my $rules = Validation::Class::Simple->new(
16 fields => {
17 user_ident => {
18 filters => 'trim'
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
32 Validation::Class::Directive::Filters is a core validation class field
33 directive that specifies which filter should be executed on the
34 associated field.
35
36 · alternative argument: an-array-of-options
37
38 · option: trim e.g. remove leading/trailing spaces
39
40 · option: strip e.g. replace multiple spaces with one space
41
42 · option: lowercase e.g. convert to lowercase
43
44 · option: uppercase e.g. convert to uppercase
45
46 · option: titlecase e.g. uppercase first letter of each word; all
47 else lowercase
48
49 · option: autocase e.g. uppercase first letter of each word
50
51 · option: capitalize e.g. uppercase the first letter
52
53 · option: alphanumeric e.g. remove non-any alphanumeric
54 characters
55
56 · option: numeric e.g. remove any non-numeric characters
57
58 · option: alpha e.g. remove any non-alpha characters
59
60 · option: decimal e.g. preserve only numeric, dot and comma
61 characters
62
63 This directive can be passed a single value or an array of
64 values:
65
66 fields => {
67 user_ident => {
68 filters => ['trim', 'strip']
69 }
70 }
71
73 Al Newkirk <anewkirk@ana.io>
74
76 This software is copyright (c) 2011 by Al Newkirk.
77
78 This is free software; you can redistribute it and/or modify it under
79 the same terms as the Perl 5 programming language system itself.
80
81
82
83perl v5.30.0 2019-V0a7l-i2d6ation::Class::Directive::Filters(3)