line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cikl::DataTypes::Integer; |
2
|
2
|
|
|
2
|
|
1541
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
105
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
53
|
|
4
|
2
|
|
|
2
|
|
1139
|
use namespace::autoclean; |
|
2
|
|
|
|
|
33907
|
|
|
2
|
|
|
|
|
12
|
|
5
|
2
|
|
|
2
|
|
134
|
use Mouse::Util::TypeConstraints; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
21
|
|
6
|
2
|
|
|
2
|
|
212
|
use Scalar::Util qw/looks_like_number/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
454
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
subtype "Cikl::DataTypes::Integer", |
9
|
|
|
|
|
|
|
as 'Int', |
10
|
|
|
|
|
|
|
where { |
11
|
|
|
|
|
|
|
my $v = $_; |
12
|
|
|
|
|
|
|
return( |
13
|
|
|
|
|
|
|
(looks_like_number($v) > 1) # returns 1 if it's a string, > 1 if it is a number |
14
|
|
|
|
|
|
|
&& ($v == int($v))); # If it is a number, then check to see if our value |
15
|
|
|
|
|
|
|
# is actually an integer. |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
coerce 'Cikl::DataTypes::Integer', |
19
|
|
|
|
|
|
|
from 'Defined', |
20
|
|
|
|
|
|
|
via { int($_) }; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |