Valida...::Error(3pm)

πŸ“¦
version 7.900059 Β· 7 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Validation::Class::Directive::Error πŸ’–

okay bestie, so this page is from the Perl docs, third section, and the whole thing is filed under the name Valida...::Error(3pm) β€” that's the title, that's the manual name, and now it's our whole personality for the next five minutes 🫢

It's the Error Directive for Validation Class Field Definitions. Yes, that is the actual full name. Yes, it's a mouthful. No, we're not shortening it, it's iconic.


✨ VERSION ✨

version 7.900059 β€” that's the one, no cap πŸ’…


🌸 SYNOPSIS 🌸

here's the vibe, bestie, a whole little love story between you and your validation rules:

use Validation::Class::Simple;

my $rules = Validation::Class::Simple->new(
    fields => {
        username => {
            error => 'This is not a valid username'
        }
    }
);

# set parameters to be validated
$rules->params->add($parameters);

# validate
unless ($rules->validate) {
    # handle the failures
}

so you make your $rules, you tell it what fields look like, you set your error message, then you yeet your $parameters into $rules->params->add($parameters), then you validate β€” and if it doesn't pass, girl, you # handle the failures 😭


πŸ¦‹ DESCRIPTION πŸ¦‹

Validation::Class::Directive::Error is a core validation class field directive, and what it does is hold the error message that will supersede any other error messages that attempt to register errors at the field-level for the associated field.

read that again bestie. it's not a message. it's THE message. it overrides all the other little messages that try to register errors at the field-level for the field it's attached to. main character energy fr fr πŸ‘‘


πŸ’œ AUTHOR πŸ’œ

Al Newkirk <anewkirk@ana.io> β€” we stan, the legend themselves 🫢


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, babe β€” generated with perl v5.36.0 on 2023-06-11, sourced from the one and only Valida...::Error(3pm) πŸ’– slay, you're a validation expert now, periodt ✨

πŸ“¦ where this page comes from