our
$VERSION
=
'0.001014'
;
qw(PositiveNum PositiveOrZeroNum
PositiveInt PositiveOrZeroInt
NegativeNum NegativeOrZeroNum
NegativeInt NegativeOrZeroInt
SingleDigit)
];
use
if
MooseX::Types->VERSION >= 0.42,
'namespace::autoclean'
;
subtype PositiveNum,
as Num,
where {
$_
> 0 },
message {
"Must be a positive number"
},
(
$Moose::VERSION
>= 2.0200
? inline_as {
$_
[0]->parent()->_inline_check(
$_
[1] ) .
' && '
.
qq{ ($_[1] > 0) }
;
}
: ()
);
subtype PositiveOrZeroNum,
as Num,
where {
$_
>= 0 },
message {
"Must be a number greater than or equal to zero"
},
(
$Moose::VERSION
>= 2.0200
? inline_as {
$_
[0]->parent()->_inline_check(
$_
[1] ) .
' && '
.
qq{ ($_[1] >= 0) }
;
}
: ()
);
subtype PositiveInt,
as Int,
where {
$_
> 0 },
message {
"Must be a positive integer"
},
(
$Moose::VERSION
>= 2.0200
? inline_as {
$_
[0]->parent()->_inline_check(
$_
[1] ) .
' && '
.
qq{ ($_[1] > 0) }
;
}
: ()
);
subtype PositiveOrZeroInt,
as Int,
where {
$_
>= 0 },
message {
"Must be an integer greater than or equal to zero"
},
(
$Moose::VERSION
>= 2.0200
? inline_as {
$_
[0]->parent()->_inline_check(
$_
[1] ) .
' && '
.
qq{ ($_[1] >= 0) }
;
}
: ()
);
subtype NegativeNum,
as Num,
where {
$_
< 0 },
message {
"Must be a negative number"
},
(
$Moose::VERSION
>= 2.0200
? inline_as {
$_
[0]->parent()->_inline_check(
$_
[1] ) .
' && '
.
qq{ ($_[1] < 0) }
;
}
: ()
);
subtype NegativeOrZeroNum,
as Num,
where {
$_
<= 0 },
message {
"Must be a number less than or equal to zero"
},
(
$Moose::VERSION
>= 2.0200
? inline_as {
$_
[0]->parent()->_inline_check(
$_
[1] ) .
' && '
.
qq{ ($_[1] <= 0) }
;
}
: ()
);
subtype NegativeInt,
as Int,
where {
$_
< 0 },
message {
"Must be a negative integer"
},
(
$Moose::VERSION
>= 2.0200
? inline_as {
$_
[0]->parent()->_inline_check(
$_
[1] ) .
' && '
.
qq{ ($_[1] < 0) }
;
}
: ()
);
subtype NegativeOrZeroInt,
as Int,
where {
$_
<= 0 },
message {
"Must be an integer less than or equal to zero"
},
(
$Moose::VERSION
>= 2.0200
? inline_as {
$_
[0]->parent()->_inline_check(
$_
[1] ) .
' && '
.
qq{ ($_[1] <= 0) }
;
}
: ()
);
subtype SingleDigit,
as Int,
where {
$_
>= -9 and
$_
<= 9 },
message {
"Must be a single digit"
},
(
$Moose::VERSION
>= 2.0200
? inline_as {
$_
[0]->parent()->_inline_check(
$_
[1] ) .
' && '
.
qq{ ($_[1] >= -9 and $_[1] <= 9) }
;
}
: ()
);
1;