Valida...pendsOn(3pm)

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

πŸ’– NAME πŸ’–

Validation::Class::Directive::DependsOn β€” bestie, it's the DependsOn directive for Validation Class Field Definitions. That's the whole vibe. It's the little field-level rule that goes "hey, this thing can't show up alone, it needs its friends here first." πŸ‘‘

You'll see it filed under the manual page name Valida...pendsOn(3pm) (yes the name is squished, that's just how the page is titled, don't @ me).


✨ VERSION ✨

version 7.900059

That's the one, that's the version, no cap. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so here's how you actually use it:

use Validation::Class::Simple;

my $rules = Validation::Class::Simple->new(
    fields => {
        password_confirmation  => {
            depends_on => 'password'
        }
    }
);

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

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

see how password_confirmation is like "I'm not validating unless password is here too"? that's the entire plot. it's giving codependent in the healthiest way possible 🫢


🌸 DESCRIPTION 🌸

Validation::Class::Directive::DependsOn is a core validation class field directive, and what it does is validate the existence of dependent parameters. literally its whole job. it checks that the parameters it's depending on are actually there. that's it, that's the directive, and it ate. πŸ”₯

  • alternative argument: an-array-of-parameter-names

This directive can be passed a single value or an array of values:

fields => {
    password2_confirmation => {
        depends_on => ['password', 'password2']
    }
}

so one dependency? cute. a whole list of dependencies? also completely valid, you just hand it an array. main character energy either way ✨


πŸ’œ AUTHOR πŸ’œ

Al Newkirk <anewkirk@ana.io>

the icon who wrote it. respect. πŸ‘‘


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.

bestie that means it's free software, go forth and remix, just keep the same terms as Perl 5 itself. periodt. πŸ’–

and that's a wrap! this page came from the User Contributed Perl Documentation, it's perl v5.36.0, dated 2023-06-11, and it was serving Valida...pendsOn(3pm) the entire time. ily, go validate something responsibly πŸŒˆπŸ¦‹β­

πŸ“¦ where this page comes from