1Validation::Class::DireUcsteirveC:o:nMtersisbaugteesdV(a3Pl)eirdlatDioocnu:m:eCnltaastsi:o:nDirective::Messages(3)
2
3
4
6 Validation::Class::Directive::Messages - Messages Directive for
7 Validation Class Field Definitions
8
10 version 7.900059
11
13 use Validation::Class::Simple;
14
15 my $rules = Validation::Class::Simple->new(
16 fields => {
17 username => {
18 required => 1,
19 min_length => 5,
20 messages => {
21 required => '%s is mandatory',
22 min_length => '%s is not the correct length'
23 }
24 }
25 }
26 );
27
28 # set parameters to be validated
29 $rules->params->add($parameters);
30
31 # validate
32 unless ($rules->validate) {
33 # handle the failures
34 }
35
37 Validation::Class::Directive::Messages is a core validation class field
38 directive that holds error message which will supersede the default
39 error messages of the associated directives.
40
42 Al Newkirk <anewkirk@ana.io>
43
45 This software is copyright (c) 2011 by Al Newkirk.
46
47 This is free software; you can redistribute it and/or modify it under
48 the same terms as the Perl 5 programming language system itself.
49
50
51
52perl v5.38.0 2023V-a0l7i-d2a1tion::Class::Directive::Messages(3)