1Validation::Class::ExpoUrsteerr(C3o)ntributed Perl DocumVeanltiadtaitoinon::Class::Exporter(3)
2
3
4

NAME

6       Validation::Class::Exporter - Simple Exporter for Validation::Class
7       Classes
8

VERSION

10       version 7.900059
11

SYNOPSIS

13           package MyApp::Validator;
14
15           use Validation::Class;
16           use Validation::Class::Exporter;
17
18           my @settings = (
19               classes => [
20                   MyApp::Validator::DomainAlpha
21                   MyApp::Validator::DomainBeta
22               ]
23           );
24
25           Validation::Class::Exporter->apply_spec(
26               routines => ['thing'], # export additional routines as is
27               settings => [@settings] # passed to the `load` keyword in V::C
28           );
29
30           sub thing {
31
32               my $args = pop;
33
34               my $class = shift || caller;
35
36               # routine as a keyword
37
38               # ... do some thing
39
40           };
41
42       ... in your application class:
43
44           package MyApp;
45
46           use MyApp::Validator;
47
48           thing ['a', 'b'];
49
50       ... in your application:
51
52           package main;
53
54           my $app = MyApp->new;
55

DESCRIPTION

57       This module (while experimental) encapsulates the exporting of keywords
58       and routines. It applies the Validation::Class framework along with any
59       keyword routines and/or sub-routines specified with the apply_spec()
60       method. It does this by simply by copying the spec into the calling
61       class.
62
63       To simplify writing exporter modules, "Validation::Class::Exporter"
64       also imports "strict" and "warnings" into your exporter module, as well
65       as into modules that use it.
66

METHODS

68   apply_spec
69       When you call this method, "Validation::Class::Exporter" builds a
70       custom "import" method on the calling class. The "import" method will
71       export the functions you specify, and can also automatically export
72       "Validation::Class" making the calling class a Validation::Class
73       derived class.
74
75       This method accepts the following parameters:
76
77       •       routines => [ ... ]
78
79               This list of function names only will be exported into the
80               calling class exactly as is, the functions can be used
81               traditionally or as keywords so their parameter handling should
82               be configured accordingly.
83
84       •       settings => [ ... ]
85
86               This list of key/value pair will be passed to the load method
87               imported from "Validation::Class::load" and will be applied on
88               the calling class.
89
90               This approach affords you some trickery in that you can utilize
91               the load method to apply the current class' configuration to
92               the calling class' configuration, etc.
93

AUTHOR

95       Al Newkirk <anewkirk@ana.io>
96
98       This software is copyright (c) 2011 by Al Newkirk.
99
100       This is free software; you can redistribute it and/or modify it under
101       the same terms as the Perl 5 programming language system itself.
102
103
104
105perl v5.38.0                      2023-07-21    Validation::Class::Exporter(3)
Impressum