1Validation::Class::DireUcsteirveC:o:nDterfiabuultte(d3V)PaelrildaDtoicounm:e:nCtlaatsiso:n:Directive::Default(3)
2
3
4

NAME

6       Validation::Class::Directive::Default - Default Directive for
7       Validation Class Field Definitions
8

VERSION

10       version 7.900057
11

SYNOPSIS

13           use Validation::Class::Simple;
14
15           my $rules = Validation::Class::Simple->new(
16               fields => {
17                   access_code  => {
18                       default => 'demo123'
19                   }
20               }
21           );
22
23           # set parameters to be validated
24           $rules->params->add($parameters);
25
26           # validate
27           unless ($rules->validate) {
28               # handle the failures
29           }
30

DESCRIPTION

32       Validation::Class::Directive::Default is a core validation class field
33       directive that holds the value which should be used if no parameter is
34       supplied.
35
36       ยท       alternative argument: a-coderef-returning-a-default-value
37
38               This directive can be passed a single value or a coderef which
39               should return the value to be used as the default value:
40
41                   fields => {
42                       access_code => {
43                           default => sub {
44                               my $self = shift; # this coderef will receive a context object
45                               return join '::', lc __PACKAGE__, time();
46                           }
47                       }
48                   }
49

AUTHOR

51       Al Newkirk <anewkirk@ana.io>
52
54       This software is copyright (c) 2011 by Al Newkirk.
55
56       This is free software; you can redistribute it and/or modify it under
57       the same terms as the Perl 5 programming language system itself.
58
59
60
61perl v5.30.1                      2020-V0a1l-i3d0ation::Class::Directive::Default(3)
Impressum