1Types::Common::Numeric(U3s)er Contributed Perl DocumentatTiyopnes::Common::Numeric(3)
2
3
4
6 Types::Common::Numeric - drop-in replacement for
7 MooseX::Types::Common::Numeric
8
10 This module is covered by the Type-Tiny stability policy.
11
13 A drop-in replacement for MooseX::Types::Common::Numeric.
14
15 Types
16 The following types are similar to those described in
17 MooseX::Types::Common::Numeric.
18
19 • PositiveNum
20
21 • PositiveOrZeroNum
22
23 • PositiveInt
24
25 • PositiveOrZeroInt
26
27 • NegativeNum
28
29 • NegativeOrZeroNum
30
31 • NegativeInt
32
33 • NegativeOrZeroInt
34
35 • SingleDigit
36
37 "SingleDigit" interestingly accepts the numbers -9 to -1; not just
38 0 to 9.
39
40 This module also defines an extra pair of type constraints not found in
41 MooseX::Types::Common::Numeric.
42
43 • IntRange[`min, `max]
44
45 Type constraint for an integer between min and max. For example:
46
47 IntRange[1, 10]
48
49 The maximum can be omitted.
50
51 IntRange[10] # at least 10
52
53 The minimum and maximum are inclusive.
54
55 • NumRange[`min, `max]
56
57 Type constraint for a number between min and max. For example:
58
59 NumRange[0.1, 10.0]
60
61 As with IntRange, the maximum can be omitted, and the minimum and
62 maximum are inclusive.
63
64 Exclusive ranges can be useful for non-integer values, so
65 additional parameters can be given to make the minimum and maximum
66 exclusive.
67
68 NumRange[0.1, 10.0, 0, 0] # both inclusive
69 NumRange[0.1, 10.0, 0, 1] # exclusive maximum, so 10.0 is invalid
70 NumRange[0.1, 10.0, 1, 0] # exclusive minimum, so 0.1 is invalid
71 NumRange[0.1, 10.0, 1, 1] # both exclusive
72
73 Making one of the limits exclusive means that a "<" or ">" operator
74 will be used instead of the usual "<=" or ">=" operators.
75
77 Please report any bugs to
78 <https://github.com/tobyink/p5-type-tiny/issues>.
79
81 Types::Standard, Types::Common::String.
82
83 MooseX::Types::Common, MooseX::Types::Common::Numeric,
84 MooseX::Types::Common::String.
85
87 Toby Inkster <tobyink@cpan.org>.
88
90 This software is copyright (c) 2013-2014, 2017-2021 by Toby Inkster.
91
92 This is free software; you can redistribute it and/or modify it under
93 the same terms as the Perl 5 programming language system itself.
94
96 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
97 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
98 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
99
100
101
102perl v5.34.0 2021-09-13 Types::Common::Numeric(3)