1Validation::Class::DireUcsteirveC:o:nDterciibmuatle(d3V)PaelrildaDtoicounm:e:nCtlaatsiso:n:Directive::Decimal(3)
2
3
4
6 Validation::Class::Directive::Decimal - Decimal 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 amount_paid => {
18 decimal => 1
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
32 Validation::Class::Directive::Decimal is a core validation class field
33 directive that provides validation of floating point integers.
34
35 • alternative argument: a-single-variable-value
36
37 • option: 0 e.g. Any number of decimal places, including none
38
39 • option: 1 e.g. Any number of decimal places greater than 0, or
40 a float|double
41
42 • option: $n e.g. Exactly that many number of decimal places
43
44 This directive can be passed a single value only:
45
46 fields => {
47 amount_paid => {
48 decimal => 2 # 2 decimal places
49 }
50 }
51
53 Al Newkirk <anewkirk@ana.io>
54
56 This software is copyright (c) 2011 by Al Newkirk.
57
58 This is free software; you can redistribute it and/or modify it under
59 the same terms as the Perl 5 programming language system itself.
60
61
62
63perl v5.36.0 2023-V0a4l-i0d3ation::Class::Directive::Decimal(3)