1Validation::Class::SimpUlsee:r:SCtornetarmiebru(t3e)d PeVralliDdoactuimoenn:t:aCtliaosns::Simple::Streamer(3)
2
3
4

NAME

6       Validation::Class::Simple::Streamer - Simple Streaming Data Validation
7

VERSION

9       version 7.900057
10

SYNOPSIS

12           use Validation::Class::Simple::Streamer;
13
14           my $params = {
15               credit_card   => '0000000000000000',
16               email_address => 'root@localhost',
17
18           };
19
20           my $rules = Validation::Class::Simple::Streamer->new(params => $params);
21
22           # the point here is expressiveness
23           # directive methods auto-validate in boolean context !!!
24
25           if (not $rules->check('credit_card')->creditcard(['visa', 'mastercard'])) {
26               # credit card is invalid visa/mastercard
27               warn $rules->errors_to_string;
28           }
29
30           if (not $rules->check('email_address')->min_length(3)->email) {
31               # email address is invalid
32               warn $rules->errors_to_string;
33           }
34
35           # prepare password for validation
36           $rules->check('password');
37
38           die "Password is not valid"
39               unless $rules->min_symbols(1) && $rules->matches('password2');
40
41           # are you of legal age?
42           if ($rules->check('member_years_of_age')->between('18-75')) {
43               # access to explicit content approved
44           }
45
46           # get all fields with errors
47           my $fields = $rules->error_fields;
48
49           # warn with errors if any
50           warn $rules->errors_to_string unless $rules->validate;
51

DESCRIPTION

53       Validation::Class::Simple::Streamer is a simple streaming validation
54       module that makes data validation fun. Target parameters and attach
55       matching fields and directives to them by chaining together methods
56       which represent Validation::Class directives. This module is built
57       around the powerful Validation::Class data validation framework via
58       Validation::Class::Simple. This module is a sub-class of and derived
59       from the Validation::Class::Simple class.
60

RATIONALE

62       If you are new to Validation::Class, or would like more information on
63       the underpinnings of this library and how it views and approaches data
64       validation, please review Validation::Class::Whitepaper. Please review
65       the "GUIDED-TOUR" in Validation::Class::Cookbook for a detailed step-
66       by-step look into how Validation::Class works.
67

METHODS

69   check
70       The check method specifies the parameter to be affected by directive
71       methods if/when called.
72
73           $self = $self->check('email_address'); # focus on email_address
74
75           $self->required;        # apply the Required directive to email_address
76           $self->min_symbols(1);  # apply the MinSymbols directive to email_address
77           $self->min_length(5);   # apply the MinLength directive to email_address
78
79   clear
80       The clear method resets the validation queue and declared fields but
81       leaves the declared parameters in-tact, almost like the object state
82       post-instantiation.
83
84           $self->clear;
85
86   messages
87       The messages method returns any registered errors as a concatenated
88       string using the "errors_to_string" in Validation::Class::Prototype
89       method and accepts the same parameters.
90
91           print $self->messages;
92
93   validate
94       The validate method uses the validator to perform data validation based
95       on the series and sequence of commands issued previously. This method
96       is called implicitly whenever the object is used in boolean context,
97       e.g. in a conditional.
98
99           $true = $self->validate;
100

PROXY METHODS

102       Each instance of Validation::Class::Simple::Streamer is injected with a
103       few proxy methods which are basically aliases to the corresponding
104       prototype class methods, however it is possible to access the prototype
105       directly using the proto/prototype methods.
106
107   class
108           $self->class;
109
110       See "class" in Validation::Class::Prototype for full documentation.
111
112   clear_queue
113           $self->clear_queue;
114
115       See "clear_queue" in Validation::Class::Prototype for full
116       documentation.
117
118   error_count
119           $self->error_count;
120
121       See "error_count" in Validation::Class::Prototype for full
122       documentation.
123
124   error_fields
125           $self->error_fields;
126
127       See "error_fields" in Validation::Class::Prototype for full
128       documentation.
129
130   errors
131           $self->errors;
132
133       See "errors" in Validation::Class::Prototype for full documentation.
134
135   errors_to_string
136           $self->errors_to_string;
137
138       See "errors_to_string" in Validation::Class::Prototype for full
139       documentation.
140
141   get_errors
142           $self->get_errors;
143
144       See "get_errors" in Validation::Class::Prototype for full
145       documentation.
146
147   get_fields
148           $self->get_fields;
149
150       See "get_fields" in Validation::Class::Prototype for full
151       documentation.
152
153   get_hash
154           $self->get_hash;
155
156       See "get_hash" in Validation::Class::Prototype for full documentation.
157
158   get_params
159           $self->get_params;
160
161       See "get_params" in Validation::Class::Prototype for full
162       documentation.
163
164   get_values
165           $self->get_values;
166
167       See "get_values" in Validation::Class::Prototype for full
168       documentation.
169
170   fields
171           $self->fields;
172
173       See "fields" in Validation::Class::Prototype for full documentation.
174
175   filtering
176           $self->filtering;
177
178       See "filtering" in Validation::Class::Prototype for full documentation.
179
180   ignore_failure
181           $self->ignore_failure;
182
183       See "ignore_failure" in Validation::Class::Prototype for full
184       documentation.
185
186   ignore_unknown
187           $self->ignore_unknown;
188
189       See "ignore_unknown" in Validation::Class::Prototype for full
190       documentation.
191
192   is_valid
193           $self->is_valid;
194
195       See "is_valid" in Validation::Class::Prototype for full documentation.
196
197   param
198           $self->param;
199
200       See "param" in Validation::Class::Prototype for full documentation.
201
202   params
203           $self->params;
204
205       See "params" in Validation::Class::Prototype for full documentation.
206
207   plugin
208           $self->plugin;
209
210       See "plugin" in Validation::Class::Prototype for full documentation.
211
212   queue
213           $self->queue;
214
215       See "queue" in Validation::Class::Prototype for full documentation.
216
217   report_failure
218           $self->report_failure;
219
220       See "report_failure" in Validation::Class::Prototype for full
221       documentation.
222
223   report_unknown
224           $self->report_unknown;
225
226       See "report_unknown" in Validation::Class::Prototype for full
227       documentation.
228
229   reset_errors
230           $self->reset_errors;
231
232       See "reset_errors" in Validation::Class::Prototype for full
233       documentation.
234
235   reset_fields
236           $self->reset_fields;
237
238       See "reset_fields" in Validation::Class::Prototype for full
239       documentation.
240
241   reset_params
242           $self->reset_params;
243
244       See "reset_params" in Validation::Class::Prototype for full
245       documentation.
246
247   set_errors
248           $self->set_errors;
249
250       See "set_errors" in Validation::Class::Prototype for full
251       documentation.
252
253   set_fields
254           $self->set_fields;
255
256       See "set_fields" in Validation::Class::Prototype for full
257       documentation.
258
259   set_params
260           $self->set_params;
261
262       See "set_params" in Validation::Class::Prototype for full
263       documentation.
264
265   set_method
266           $self->set_method;
267
268       See "set_method" in Validation::Class::Prototype for full
269       documentation.
270
271   stash
272           $self->stash;
273
274       See "stash" in Validation::Class::Prototype for full documentation.
275
276   validate
277           $self->validate;
278
279       See "validate" in Validation::Class::Prototype for full documentation.
280
281   validate_method
282           $self->validate_method;
283
284       See "validate_method" in Validation::Class::Prototype for full
285       documentation.
286
287   validate_profile
288           $self->validate_profile;
289
290       See "validate_profile" in Validation::Class::Prototype for full
291       documentation.
292

AUTHOR

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.1                      2020-01V-a3l0idation::Class::Simple::Streamer(3)
Impressum