Valida...ssages(3pm)

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

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

okay so bestie, welcome to the Messages directive page β€” part of the User Contributed Perl Documentation (that's the 3pm manual section, iykyk). This is the Messages Directive for Validation Class Field Definitions, and she's a whole vibe. ✨


🌸 VERSION 🌸

version 7.900059 β€” yes, that's the number, no cap, don't @ me πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

like, here's the whole thing, literally verbatim, because copying code is a crime:

use Validation::Class::Simple;

my $rules = Validation::Class::Simple->new(
    fields => {
        username => {
            required   => 1,
            min_length => 5,
            messages => {
                required   => '%s is mandatory',
                min_length => '%s is not the correct length'
            }
        }
    }
);

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

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

so cute, so clean, so iconic πŸŽ€


🌈 DESCRIPTION 🌈

okay so, Validation::Class::Directive::Messages is a core validation class field directive 🫢

and what does she do? she holds the error message that will supersede the default error messages of the associated directives. like, she's the main character and she's taking over, periodt. πŸ‘‘

so when a directive would normally spit out its default little error message, the message you stash in messages shows up instead. the way that works is genuinely so slay.


🧚 AUTHOR 🧚

Al Newkirk <anewkirk@ana.io> β€” the genius behind all this, we stan πŸ’œ


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. fr fr, it's free, go wild πŸ¦‹


ngl, if you're out here messing with messages, remember: those custom strings supersede the defaults. don't be shocked when your own words show up instead. that's the whole point, bestie. πŸ’–

okay and finally, a lil sign-off: this page came to you courtesy of perl v5.36.0, dated 2023-06-11, and yes, that's the same Validation::Class::Directive::Messages(3pm) girly from the very top. πŸŽ€ byeeee, go write some banger error messages πŸ’…βœ¨

πŸ“¦ where this page comes from