.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Validation::Class::Simple::Streamer 3pm" .TH Validation::Class::Simple::Streamer 3pm "2023-06-11" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Validation::Class::Simple::Streamer \- Simple Streaming Data Validation .SH "VERSION" .IX Header "VERSION" version 7.900059 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Validation::Class::Simple::Streamer; \& \& my $params = { \& credit_card => \*(Aq0000000000000000\*(Aq, \& email_address => \*(Aqroot@localhost\*(Aq, \& \& }; \& \& my $rules = Validation::Class::Simple::Streamer\->new(params => $params); \& \& # the point here is expressiveness \& # directive methods auto\-validate in boolean context !!! \& \& if (not $rules\->check(\*(Aqcredit_card\*(Aq)\->creditcard([\*(Aqvisa\*(Aq, \*(Aqmastercard\*(Aq])) { \& # credit card is invalid visa/mastercard \& warn $rules\->errors_to_string; \& } \& \& if (not $rules\->check(\*(Aqemail_address\*(Aq)\->min_length(3)\->email) { \& # email address is invalid \& warn $rules\->errors_to_string; \& } \& \& # prepare password for validation \& $rules\->check(\*(Aqpassword\*(Aq); \& \& die "Password is not valid" \& unless $rules\->min_symbols(1) && $rules\->matches(\*(Aqpassword2\*(Aq); \& \& # are you of legal age? \& if ($rules\->check(\*(Aqmember_years_of_age\*(Aq)\->between(\*(Aq18\-75\*(Aq)) { \& # access to explicit content approved \& } \& \& # get all fields with errors \& my $fields = $rules\->error_fields; \& \& # warn with errors if any \& warn $rules\->errors_to_string unless $rules\->validate; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Validation::Class::Simple::Streamer is a simple streaming validation module that makes data validation fun. Target parameters and attach matching fields and directives to them by chaining together methods which represent Validation::Class directives. This module is built around the powerful Validation::Class data validation framework via Validation::Class::Simple. This module is a sub-class of and derived from the Validation::Class::Simple class. .SH "RATIONALE" .IX Header "RATIONALE" If you are new to Validation::Class, or would like more information on the underpinnings of this library and how it views and approaches data validation, please review Validation::Class::Whitepaper. Please review the \*(L"GUIDED-TOUR\*(R" in Validation::Class::Cookbook for a detailed step-by-step look into how Validation::Class works. .SH "METHODS" .IX Header "METHODS" .SS "check" .IX Subsection "check" The check method specifies the parameter to be affected by directive methods if/when called. .PP .Vb 1 \& $self = $self\->check(\*(Aqemail_address\*(Aq); # focus on email_address \& \& $self\->required; # apply the Required directive to email_address \& $self\->min_symbols(1); # apply the MinSymbols directive to email_address \& $self\->min_length(5); # apply the MinLength directive to email_address .Ve .SS "clear" .IX Subsection "clear" The clear method resets the validation queue and declared fields but leaves the declared parameters in-tact, almost like the object state post-instantiation. .PP .Vb 1 \& $self\->clear; .Ve .SS "messages" .IX Subsection "messages" The messages method returns any registered errors as a concatenated string using the \*(L"errors_to_string\*(R" in Validation::Class::Prototype method and accepts the same parameters. .PP .Vb 1 \& print $self\->messages; .Ve .SS "validate" .IX Subsection "validate" The validate method uses the validator to perform data validation based on the series and sequence of commands issued previously. This method is called implicitly whenever the object is used in boolean context, e.g. in a conditional. .PP .Vb 1 \& $true = $self\->validate; .Ve .SH "PROXY METHODS" .IX Header "PROXY METHODS" Each instance of Validation::Class::Simple::Streamer is injected with a few proxy methods which are basically aliases to the corresponding prototype class methods, however it is possible to access the prototype directly using the proto/prototype methods. .SS "class" .IX Subsection "class" .Vb 1 \& $self\->class; .Ve .PP See \*(L"class\*(R" in Validation::Class::Prototype for full documentation. .SS "clear_queue" .IX Subsection "clear_queue" .Vb 1 \& $self\->clear_queue; .Ve .PP See \*(L"clear_queue\*(R" in Validation::Class::Prototype for full documentation. .SS "error_count" .IX Subsection "error_count" .Vb 1 \& $self\->error_count; .Ve .PP See \*(L"error_count\*(R" in Validation::Class::Prototype for full documentation. .SS "error_fields" .IX Subsection "error_fields" .Vb 1 \& $self\->error_fields; .Ve .PP See \*(L"error_fields\*(R" in Validation::Class::Prototype for full documentation. .SS "errors" .IX Subsection "errors" .Vb 1 \& $self\->errors; .Ve .PP See \*(L"errors\*(R" in Validation::Class::Prototype for full documentation. .SS "errors_to_string" .IX Subsection "errors_to_string" .Vb 1 \& $self\->errors_to_string; .Ve .PP See \*(L"errors_to_string\*(R" in Validation::Class::Prototype for full documentation. .SS "get_errors" .IX Subsection "get_errors" .Vb 1 \& $self\->get_errors; .Ve .PP See \*(L"get_errors\*(R" in Validation::Class::Prototype for full documentation. .SS "get_fields" .IX Subsection "get_fields" .Vb 1 \& $self\->get_fields; .Ve .PP See \*(L"get_fields\*(R" in Validation::Class::Prototype for full documentation. .SS "get_hash" .IX Subsection "get_hash" .Vb 1 \& $self\->get_hash; .Ve .PP See \*(L"get_hash\*(R" in Validation::Class::Prototype for full documentation. .SS "get_params" .IX Subsection "get_params" .Vb 1 \& $self\->get_params; .Ve .PP See \*(L"get_params\*(R" in Validation::Class::Prototype for full documentation. .SS "get_values" .IX Subsection "get_values" .Vb 1 \& $self\->get_values; .Ve .PP See \*(L"get_values\*(R" in Validation::Class::Prototype for full documentation. .SS "fields" .IX Subsection "fields" .Vb 1 \& $self\->fields; .Ve .PP See \*(L"fields\*(R" in Validation::Class::Prototype for full documentation. .SS "filtering" .IX Subsection "filtering" .Vb 1 \& $self\->filtering; .Ve .PP See \*(L"filtering\*(R" in Validation::Class::Prototype for full documentation. .SS "ignore_failure" .IX Subsection "ignore_failure" .Vb 1 \& $self\->ignore_failure; .Ve .PP See \*(L"ignore_failure\*(R" in Validation::Class::Prototype for full documentation. .SS "ignore_unknown" .IX Subsection "ignore_unknown" .Vb 1 \& $self\->ignore_unknown; .Ve .PP See \*(L"ignore_unknown\*(R" in Validation::Class::Prototype for full documentation. .SS "is_valid" .IX Subsection "is_valid" .Vb 1 \& $self\->is_valid; .Ve .PP See \*(L"is_valid\*(R" in Validation::Class::Prototype for full documentation. .SS "param" .IX Subsection "param" .Vb 1 \& $self\->param; .Ve .PP See \*(L"param\*(R" in Validation::Class::Prototype for full documentation. .SS "params" .IX Subsection "params" .Vb 1 \& $self\->params; .Ve .PP See \*(L"params\*(R" in Validation::Class::Prototype for full documentation. .SS "plugin" .IX Subsection "plugin" .Vb 1 \& $self\->plugin; .Ve .PP See \*(L"plugin\*(R" in Validation::Class::Prototype for full documentation. .SS "queue" .IX Subsection "queue" .Vb 1 \& $self\->queue; .Ve .PP See \*(L"queue\*(R" in Validation::Class::Prototype for full documentation. .SS "report_failure" .IX Subsection "report_failure" .Vb 1 \& $self\->report_failure; .Ve .PP See \*(L"report_failure\*(R" in Validation::Class::Prototype for full documentation. .SS "report_unknown" .IX Subsection "report_unknown" .Vb 1 \& $self\->report_unknown; .Ve .PP See \*(L"report_unknown\*(R" in Validation::Class::Prototype for full documentation. .SS "reset_errors" .IX Subsection "reset_errors" .Vb 1 \& $self\->reset_errors; .Ve .PP See \*(L"reset_errors\*(R" in Validation::Class::Prototype for full documentation. .SS "reset_fields" .IX Subsection "reset_fields" .Vb 1 \& $self\->reset_fields; .Ve .PP See \*(L"reset_fields\*(R" in Validation::Class::Prototype for full documentation. .SS "reset_params" .IX Subsection "reset_params" .Vb 1 \& $self\->reset_params; .Ve .PP See \*(L"reset_params\*(R" in Validation::Class::Prototype for full documentation. .SS "set_errors" .IX Subsection "set_errors" .Vb 1 \& $self\->set_errors; .Ve .PP See \*(L"set_errors\*(R" in Validation::Class::Prototype for full documentation. .SS "set_fields" .IX Subsection "set_fields" .Vb 1 \& $self\->set_fields; .Ve .PP See \*(L"set_fields\*(R" in Validation::Class::Prototype for full documentation. .SS "set_params" .IX Subsection "set_params" .Vb 1 \& $self\->set_params; .Ve .PP See \*(L"set_params\*(R" in Validation::Class::Prototype for full documentation. .SS "set_method" .IX Subsection "set_method" .Vb 1 \& $self\->set_method; .Ve .PP See \*(L"set_method\*(R" in Validation::Class::Prototype for full documentation. .SS "stash" .IX Subsection "stash" .Vb 1 \& $self\->stash; .Ve .PP See \*(L"stash\*(R" in Validation::Class::Prototype for full documentation. .SS "validate" .IX Subsection "validate" .Vb 1 \& $self\->validate; .Ve .PP See \*(L"validate\*(R" in Validation::Class::Prototype for full documentation. .SS "validate_method" .IX Subsection "validate_method" .Vb 1 \& $self\->validate_method; .Ve .PP See \*(L"validate_method\*(R" in Validation::Class::Prototype for full documentation. .SS "validate_profile" .IX Subsection "validate_profile" .Vb 1 \& $self\->validate_profile; .Ve .PP See \*(L"validate_profile\*(R" in Validation::Class::Prototype for full documentation. .SH "AUTHOR" .IX Header "AUTHOR" Al Newkirk .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2011 by Al Newkirk. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.