Valida...xporter(3pm)
β¨ Validation::Class::Exporter π
okay bestie, gather round π«Ά this is Validation::Class::Exporter β the User Contributed Perl Documentation page for it, and yeah, it's version 7.900059. it's giving "simple exporter for Validation::Class classes" and honestly? it's serving exactly that. π
πΈ NAME πΈ
Validation::Class::Exporter β a Simple Exporter for Validation::Class Classes. literally that's the whole vibe. β¨
π VERSION π
version 7.900059, no cap. π
π¦ SYNOPSIS π¦
okay so here's the tea, bestie. first you set up your validator package like this:
package MyApp::Validator;
use Validation::Class;
use Validation::Class::Exporter;
my @settings = (
classes => [
MyApp::Validator::DomainAlpha
MyApp::Validator::DomainBeta
]
);
Validation::Class::Exporter->apply_spec(
routines => ['thing'], # export additional routines as is
settings => [@settings] # passed to the `load` keyword in V::C
);
sub thing {
my $args = pop;
my $class = shift || caller;
# routine as a keyword
# ... do some thing
};
then ... in your application class:
package MyApp;
use MyApp::Validator;
thing ['a', 'b'];
and finally, ... in your application:
package main;
my $app = MyApp->new;
and that's it. main character energy from start to finish. π
π« DESCRIPTION π«
so this module β and yes, it's experimental, we're being upfront about that, bestie β encapsulates the exporting of keywords and routines. π
the way it works: it applies the Validation::Class framework, along with any keyword routines and/or sub-routines you specified with the apply_spec() method. and how does it pull that off? simply by copying the spec into the calling class. that's the whole trick. iconic. π
and to make writing exporter modules easier for you, Validation::Class::Exporter also imports strict and warnings into your exporter module β and into modules that use it. so like, it's looking out for you fr fr. π«Ά
β METHODS β
π apply_spec π
when you call this method, Validation::Class::Exporter builds a custom import method on the calling class. that import method will export the functions you specify, and it can also automatically export Validation::Class β which makes the calling class a Validation::Class derived class. slay. π
this method accepts the following parameters:
routines => [ ... ]β this list of function names only will be exported into the calling class exactly as is. the functions can be used traditionally or as keywords, so their parameter handling should be configured accordingly. (iykyk π₯)settings => [ ... ]β this list of key/value pair will be passed to theloadmethod imported fromValidation::Class::load, and will be applied on the calling class.
and okay, this approach affords you some trickery π β because you can utilize the load method to apply the current class' configuration to the calling class' configuration, etc. etc. the possibilities? endless, bestie. β¨
π AUTHOR π
Al Newkirk <anewkirk@ana.io> β the icon, the legend. π
π 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. periodt. π
okay and that's a wrap bestie!! this page is fromperl v5.36.0and got dated2023-06-11β go forth and export those routines, you absolute queen πΈπ¦β¨π
π¦ 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