Valida...treamer(3pm)
π Valida...treamer(3pm) π
okay bestie, so this is a page from the User Contributed Perl Documentation section, manual name Valida...treamer(3pm), and it's genuinely one of my faves. no cap.
β¨ NAME β¨
Validation::Class::Simple::Streamer β Simple Streaming Data Validation π
πΈ VERSION πΈ
version 7.900059 β¨ (yes it's giving very specific, we love a precise queen)
π¦ 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. fr fr, fun. ππ
The way it works: you target parameters and attach matching fields and directives to them by chaining together methods which represent Validation::Class directives. it's giving method chaining main character energy.
This module is built around the powerful Validation::Class data validation framework via Validation::Class::Simple. And plot twist β this module is a sub-class of and derived from the Validation::Class::Simple class. slay. π
π RATIONALE π
If you're new to Validation::Class, or you just want more info on the underpinnings of this library and how it views and approaches data validation, please review Validation::Class::Whitepaper. π
Also pls review the "GUIDED-TOUR" in Validation::Class::Cookbook for a detailed step-by-step look into how Validation::Class works. it's the tutorial arc, and honestly? iconic.
π METHODS π
π check
The check method specifies the parameter to be affected by directive methods if/when called. like, you're picking your target, bestie.
$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. a little factory reset for the vibes only. β¨
$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. sneaky? no. efficient? yes. π
$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. iykyk. π
π¦ 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.
π«Ά and that's the whole page bestie! this one shipped asperl v5.36.0, dated2023-06-11, and honestly? it ate. go validate something and stay hydrated. π β¨
π¦ where this page comes from
- debian trixie: libvalidation-class-perl 7.900059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libvalidation-class-perl 7.900059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libvalidation-class-perl 7.900059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libvalidation-class-perl 7.900059-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms