Valida...::Alias(3pm)

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

✨ NAME ✨

Validation::Class::Directive::Alias β€” the Alias Directive for Validation Class Field Definitions, bestie πŸ’– (you'll see it as Valida...::Alias(3pm) in your man pager because man pages love to truncate things, but that's the one)


🌸 VERSION 🌸

version 7.900059 β€” yes we're on the 7.900059 era, iconic behavior


πŸŽ€ SYNOPSIS πŸŽ€

okay so here's the vibe, literally just:

use Validation::Class::Simple;

my $rules = Validation::Class::Simple->new(
    fields => {
        login  => {
            alias => 'username'
        }
    }
);

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

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

like, you set up your field with an alias, you add your $parameters, you run validate, and if it's giving failure you handle it. no cap. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

Validation::Class::Directive::Alias is a core validation class field directive and its whole job β€” its moment, its purpose, its main character arc β€” is giving you the ability to map arbitrary parameter names with a field's parameter value. that's it. that's the directive. 🫢

  • alternative argument: an-array-of-aliases 🌈

bestie listen, this directive can be passed a single value or an array of values. both are valid. she contains multitudes:

fields => {
    login  => {
        alias => ['username', 'email_address']
    }
}

so now login is answering to username AND email_address. one field, many names, very much the way that a queen with several aliases operates πŸ‘‘


πŸ’œ AUTHOR πŸ’œ

Al Newkirk <anewkirk@ana.io> β€” the legend, the blueprint, the whole reason this exists πŸ™Œ


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, go off, remix it, it's yours 🩷


and that's the whole page bestie β€” this one came from perl v5.36.0 and got stamped on 2023-06-11, so you know it's the real deal. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from