Valida...:Simple(3pm)
π NAME π
okay so real quick β this is Validation::Class::Simple β Simple Ad-Hoc Data Validation β¨ (and yes bestie, it's from the User Contributed Perl Documentation, section 3pm, we love a community moment π«Ά)
π VERSION π
version 7.900059 β iconic, no notes π
π SYNOPSIS π
here's the vibe, copy-paste ready:
use Validation::Class::Simple;
my $params = {
name => 'Root',
email => 'root@localhost',
pass => 's3cret',
pass2 => 's2cret'
};
# define object specific rules
my $rules = Validation::Class::Simple->new(
# define fields on-the-fly
fields => {
name => { required => 1 },
email => { required => 1 },
pass => { required => 1 },
pass2 => { required => 1, matches => 'pass' },
}
);
# set parameters to be validated
$rules->params->add($params);
# validate
unless ($rules->validate) {
# handle the failures
warn $rules->errors_to_string;
}
likeβ¦ it's giving "declare your rules, feed it params, check if it ate" π
π¦ DESCRIPTION π¦
Validation::Class::Simple is a simple validation module built around the powerful Validation::Class data validation framework.
This module is merely a blank canvas, a clean validation class derived from Validation::Class which has not been pre-configured (e.g. configured via keywords, etc).
It can be useful in an environment where you wouldn't care to create a validation class and instead would simply like to pass rules to a validation engine in an ad-hoc fashion.
fr fr it's a blank canvas β nothing pre-baked, just vibes and rules β¨
πΈ QUICKSTART πΈ
If you are looking for a data validation module with an even lower learning curve built using the same tenets and principles as Validation::Class which is as simple and even lazier than this module, please review the documentation for Validation::Class::Simple::Streamer.
Please review the "GUIDED-TOUR" in Validation::Class::Cookbook for a detailed step-by-step look into how Validation::Class works.
π§ 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.
π PROXY METHODS π
Each instance of Validation::Class::Simple is associated with a prototype class which provides the data validation engine and keeps the class namespace free from pollution and collisions, please see Validation::Class::Prototype for more information on specific methods and attributes.
Validation::Class::Simple is injected with a few proxy methods which are basically aliases to the corresponding prototype (engine) class methods, however it is possible to access the prototype directly using the proto/prototype methods.
the way it keeps the namespace clean?? we stan a tidy queen π§Όβ¨
β 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_document
$self->validate_document;
See "validate_document" 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.
π EXTENSIBILITY π
Validation::Class does NOT provide method modifiers but can be easily extended with Class::Method::Modifiers.
ok so no method modifiers out of the box π but bestie, Class::Method::Modifiers has your back π«Ά
π before
before foo => sub { ... };
See "before method(s) => sub { ... }" in Class::Method::Modifiers for full documentation.
π around
around foo => sub { ... };
See "around method(s) => sub { ... }" in Class::Method::Modifiers for full documentation.
π after
after foo => sub { ... };
See "after method(s) => sub { ... }" in Class::Method::Modifiers 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 lil doc came from perl v5.36.0, dated 2023-06-11, living under the name Valida...:Simple(3pm) β mwah, iconic, go validate something β¨π
π¦
π¦ 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