Provided by: libvalidation-class-perl_7.900057-2_all bug

NAME

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

VERSION

       version 7.900057

SYNOPSIS

           use Validation::Class::Simple::Streamer;

           my $params = {
               credit_card   => '0000000000000000',
               email_address => 'root@localhost',

           };

           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('credit_card')->creditcard(['visa', 'mastercard'])) {
               # credit card is invalid visa/mastercard
               warn $rules->errors_to_string;
           }

           if (not $rules->check('email_address')->min_length(3)->email) {
               # email address is invalid
               warn $rules->errors_to_string;
           }

           # prepare password for validation
           $rules->check('password');

           die "Password is not valid"
               unless $rules->min_symbols(1) && $rules->matches('password2');

           # are you of legal age?
           if ($rules->check('member_years_of_age')->between('18-75')) {
               # 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;

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.

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 "GUIDED-TOUR" in
       Validation::Class::Cookbook for a detailed step-by-step look into how Validation::Class
       works.

METHODS

   check
       The check method specifies the parameter to be affected by directive methods if/when
       called.

           $self = $self->check('email_address'); # 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

   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.

           $self->clear;

   messages
       The messages method returns any registered errors as a concatenated string using the
       "errors_to_string" in Validation::Class::Prototype method and accepts the same parameters.

           print $self->messages;

   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.

           $true = $self->validate;

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.

   class
           $self->class;

       See "class" in Validation::Class::Prototype for full documentation.

   clear_queue
           $self->clear_queue;

       See "clear_queue" in Validation::Class::Prototype for full documentation.

   error_count
           $self->error_count;

       See "error_count" in Validation::Class::Prototype for full documentation.

   error_fields
           $self->error_fields;

       See "error_fields" in Validation::Class::Prototype for full documentation.

   errors
           $self->errors;

       See "errors" in Validation::Class::Prototype for full documentation.

   errors_to_string
           $self->errors_to_string;

       See "errors_to_string" in Validation::Class::Prototype for full documentation.

   get_errors
           $self->get_errors;

       See "get_errors" in Validation::Class::Prototype for full documentation.

   get_fields
           $self->get_fields;

       See "get_fields" in Validation::Class::Prototype for full documentation.

   get_hash
           $self->get_hash;

       See "get_hash" in Validation::Class::Prototype for full documentation.

   get_params
           $self->get_params;

       See "get_params" in Validation::Class::Prototype for full documentation.

   get_values
           $self->get_values;

       See "get_values" in Validation::Class::Prototype for full documentation.

   fields
           $self->fields;

       See "fields" in Validation::Class::Prototype for full documentation.

   filtering
           $self->filtering;

       See "filtering" in Validation::Class::Prototype for full documentation.

   ignore_failure
           $self->ignore_failure;

       See "ignore_failure" in Validation::Class::Prototype for full documentation.

   ignore_unknown
           $self->ignore_unknown;

       See "ignore_unknown" in Validation::Class::Prototype for full documentation.

   is_valid
           $self->is_valid;

       See "is_valid" in Validation::Class::Prototype for full documentation.

   param
           $self->param;

       See "param" in Validation::Class::Prototype for full documentation.

   params
           $self->params;

       See "params" in Validation::Class::Prototype for full documentation.

   plugin
           $self->plugin;

       See "plugin" in Validation::Class::Prototype for full documentation.

   queue
           $self->queue;

       See "queue" in Validation::Class::Prototype for full documentation.

   report_failure
           $self->report_failure;

       See "report_failure" in Validation::Class::Prototype for full documentation.

   report_unknown
           $self->report_unknown;

       See "report_unknown" in Validation::Class::Prototype for full documentation.

   reset_errors
           $self->reset_errors;

       See "reset_errors" in Validation::Class::Prototype for full documentation.

   reset_fields
           $self->reset_fields;

       See "reset_fields" in Validation::Class::Prototype for full documentation.

   reset_params
           $self->reset_params;

       See "reset_params" in Validation::Class::Prototype for full documentation.

   set_errors
           $self->set_errors;

       See "set_errors" in Validation::Class::Prototype for full documentation.

   set_fields
           $self->set_fields;

       See "set_fields" in Validation::Class::Prototype for full documentation.

   set_params
           $self->set_params;

       See "set_params" in Validation::Class::Prototype for full documentation.

   set_method
           $self->set_method;

       See "set_method" in Validation::Class::Prototype for full documentation.

   stash
           $self->stash;

       See "stash" in Validation::Class::Prototype for full documentation.

   validate
           $self->validate;

       See "validate" in Validation::Class::Prototype for full documentation.

   validate_method
           $self->validate_method;

       See "validate_method" in Validation::Class::Prototype for full documentation.

   validate_profile
           $self->validate_profile;

       See "validate_profile" in Validation::Class::Prototype for full documentation.

AUTHOR

       Al Newkirk <anewkirk@ana.io>

COPYRIGHT AND LICENSE

       This software is copyright (c) 2011 by Al Newkirk.

       This is free software; you can redistribute it and/or modify it under the same terms as
       the Perl 5 programming language system itself.