1Validation::Class::SimpUlsee(r3)Contributed Perl DocumenVtaaltiidoantion::Class::Simple(3)
2
3
4
6 Validation::Class::Simple - Simple Ad-Hoc Data Validation
7
9 version 7.900057
10
12 use Validation::Class::Simple;
13
14 my $params = {
15 name => 'Root',
16 email => 'root@localhost',
17 pass => 's3cret',
18 pass2 => 's2cret'
19 };
20
21 # define object specific rules
22 my $rules = Validation::Class::Simple->new(
23 # define fields on-the-fly
24 fields => {
25 name => { required => 1 },
26 email => { required => 1 },
27 pass => { required => 1 },
28 pass2 => { required => 1, matches => 'pass' },
29 }
30 );
31
32 # set parameters to be validated
33 $rules->params->add($params);
34
35 # validate
36 unless ($rules->validate) {
37 # handle the failures
38 warn $rules->errors_to_string;
39 }
40
42 Validation::Class::Simple is a simple validation module built around
43 the powerful Validation::Class data validation framework.
44
45 This module is merely a blank canvas, a clean validation class derived
46 from Validation::Class which has not been pre-configured (e.g.
47 configured via keywords, etc).
48
49 It can be useful in an environment where you wouldn't care to create a
50 validation class and instead would simply like to pass rules to a
51 validation engine in an ad-hoc fashion.
52
54 If you are looking for a data validation module with an even lower
55 learning curve built using the same tenets and principles as
56 Validation::Class which is as simple and even lazier than this module,
57 please review the documentation for
58 Validation::Class::Simple::Streamer. Please review the "GUIDED-TOUR" in
59 Validation::Class::Cookbook for a detailed step-by-step look into how
60 Validation::Class works.
61
63 If you are new to Validation::Class, or would like more information on
64 the underpinnings of this library and how it views and approaches data
65 validation, please review Validation::Class::Whitepaper.
66
68 Each instance of Validation::Class::Simple is associated with a
69 prototype class which provides the data validation engine and keeps the
70 class namespace free from pollution and collisions, please see
71 Validation::Class::Prototype for more information on specific methods
72 and attributes.
73
74 Validation::Class::Simple is injected with a few proxy methods which
75 are basically aliases to the corresponding prototype (engine) class
76 methods, however it is possible to access the prototype directly using
77 the proto/prototype methods.
78
79 class
80 $self->class;
81
82 See "class" in Validation::Class::Prototype for full documentation.
83
84 clear_queue
85 $self->clear_queue;
86
87 See "clear_queue" in Validation::Class::Prototype for full
88 documentation.
89
90 error_count
91 $self->error_count;
92
93 See "error_count" in Validation::Class::Prototype for full
94 documentation.
95
96 error_fields
97 $self->error_fields;
98
99 See "error_fields" in Validation::Class::Prototype for full
100 documentation.
101
102 errors
103 $self->errors;
104
105 See "errors" in Validation::Class::Prototype for full documentation.
106
107 errors_to_string
108 $self->errors_to_string;
109
110 See "errors_to_string" in Validation::Class::Prototype for full
111 documentation.
112
113 get_errors
114 $self->get_errors;
115
116 See "get_errors" in Validation::Class::Prototype for full
117 documentation.
118
119 get_fields
120 $self->get_fields;
121
122 See "get_fields" in Validation::Class::Prototype for full
123 documentation.
124
125 get_hash
126 $self->get_hash;
127
128 See "get_hash" in Validation::Class::Prototype for full documentation.
129
130 get_params
131 $self->get_params;
132
133 See "get_params" in Validation::Class::Prototype for full
134 documentation.
135
136 get_values
137 $self->get_values;
138
139 See "get_values" in Validation::Class::Prototype for full
140 documentation.
141
142 fields
143 $self->fields;
144
145 See "fields" in Validation::Class::Prototype for full documentation.
146
147 filtering
148 $self->filtering;
149
150 See "filtering" in Validation::Class::Prototype for full documentation.
151
152 ignore_failure
153 $self->ignore_failure;
154
155 See "ignore_failure" in Validation::Class::Prototype for full
156 documentation.
157
158 ignore_unknown
159 $self->ignore_unknown;
160
161 See "ignore_unknown" in Validation::Class::Prototype for full
162 documentation.
163
164 is_valid
165 $self->is_valid;
166
167 See "is_valid" in Validation::Class::Prototype for full documentation.
168
169 param
170 $self->param;
171
172 See "param" in Validation::Class::Prototype for full documentation.
173
174 params
175 $self->params;
176
177 See "params" in Validation::Class::Prototype for full documentation.
178
179 plugin
180 $self->plugin;
181
182 See "plugin" in Validation::Class::Prototype for full documentation.
183
184 queue
185 $self->queue;
186
187 See "queue" in Validation::Class::Prototype for full documentation.
188
189 report_failure
190 $self->report_failure;
191
192 See "report_failure" in Validation::Class::Prototype for full
193 documentation.
194
195 report_unknown
196 $self->report_unknown;
197
198 See "report_unknown" in Validation::Class::Prototype for full
199 documentation.
200
201 reset_errors
202 $self->reset_errors;
203
204 See "reset_errors" in Validation::Class::Prototype for full
205 documentation.
206
207 reset_fields
208 $self->reset_fields;
209
210 See "reset_fields" in Validation::Class::Prototype for full
211 documentation.
212
213 reset_params
214 $self->reset_params;
215
216 See "reset_params" in Validation::Class::Prototype for full
217 documentation.
218
219 set_errors
220 $self->set_errors;
221
222 See "set_errors" in Validation::Class::Prototype for full
223 documentation.
224
225 set_fields
226 $self->set_fields;
227
228 See "set_fields" in Validation::Class::Prototype for full
229 documentation.
230
231 set_params
232 $self->set_params;
233
234 See "set_params" in Validation::Class::Prototype for full
235 documentation.
236
237 set_method
238 $self->set_method;
239
240 See "set_method" in Validation::Class::Prototype for full
241 documentation.
242
243 stash
244 $self->stash;
245
246 See "stash" in Validation::Class::Prototype for full documentation.
247
248 validate
249 $self->validate;
250
251 See "validate" in Validation::Class::Prototype for full documentation.
252
253 validate_document
254 $self->validate_document;
255
256 See "validate_document" in Validation::Class::Prototype for full
257 documentation.
258
259 validate_method
260 $self->validate_method;
261
262 See "validate_method" in Validation::Class::Prototype for full
263 documentation.
264
265 validate_profile
266 $self->validate_profile;
267
268 See "validate_profile" in Validation::Class::Prototype for full
269 documentation.
270
272 Validation::Class does NOT provide method modifiers but can be easily
273 extended with Class::Method::Modifiers.
274
275 before
276 before foo => sub { ... };
277
278 See "before method(s) => sub { ... }" in Class::Method::Modifiers for
279 full documentation.
280
281 around
282 around foo => sub { ... };
283
284 See "around method(s) => sub { ... }" in Class::Method::Modifiers for
285 full documentation.
286
287 after
288 after foo => sub { ... };
289
290 See "after method(s) => sub { ... }" in Class::Method::Modifiers for
291 full documentation.
292
294 Al Newkirk <anewkirk@ana.io>
295
297 This software is copyright (c) 2011 by Al Newkirk.
298
299 This is free software; you can redistribute it and/or modify it under
300 the same terms as the Perl 5 programming language system itself.
301
302
303
304perl v5.30.0 2019-07-26 Validation::Class::Simple(3)