| 1 | package MouseX::Types::Common::Numeric; | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | our $VERSION = '0.001000'; | |
| 7 | |||
| 8 | 2 | ▶ | use MouseX::Types -declare => [ |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | qw(PositiveNum PositiveInt NegativeNum NegativeInt SingleDigit) | ||
| 10 | 2 | ]; | |
| 11 | |||
| 12 | 2 | ▶ | use MouseX::Types::Mouse qw/Num Int/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | subtype PositiveNum, | ||
| 15 | as Num, | ||
| 16 | 2 | ▶ | where { $_ >= 0 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 17 | 1 | ▶ | message { "Must be a positive number" }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 18 | |||
| 19 | subtype PositiveInt, | ||
| 20 | as Int, | ||
| 21 | 4 | ▶ | where { $_ >= 0 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 22 | 2 | ▶ | message { "Must be a positive integer" }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | subtype NegativeNum, | ||
| 25 | as Num, | ||
| 26 | 2 | ▶ | where { $_ <= 0 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 27 | 1 | ▶ | message { "Must be a negative number" }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 28 | |||
| 29 | subtype NegativeInt, | ||
| 30 | as Int, | ||
| 31 | 2 | ▶ | where { $_ <= 0 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 32 | 2 | ▶ | message { "Must be a negative integer" }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 33 | |||
| 34 | subtype SingleDigit, | ||
| 35 | as PositiveInt, | ||
| 36 | 2 | ▶ | where { $_ <= 9 }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 37 | 1 | ▶ | message { "Must be a single digit" }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 38 | |||
| 39 | |||
| 40 | 2 | 1; | |
| 41 | __END__ | ||