Valida...xporter(3pm)

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

✨ 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 the load method imported from Validation::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. πŸ‘‘

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 from perl v5.36.0 and got dated 2023-06-11 β€” go forth and export those routines, you absolute queen πŸŒΈπŸ¦‹βœ¨πŸ’–
πŸ“¦ where this page comes from