line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Numeric Data Type Role for Perl 5 |
2
|
|
|
|
|
|
|
package Data::Object::Role::Numeric; |
3
|
|
|
|
|
|
|
|
4
|
152
|
|
|
152
|
|
197011
|
use 5.010; |
|
152
|
|
|
|
|
574
|
|
5
|
152
|
|
|
152
|
|
987
|
use Data::Object::Role; |
|
152
|
|
|
|
|
333
|
|
|
152
|
|
|
|
|
960
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.42'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub downto { |
10
|
3
|
|
|
3
|
0
|
8
|
my ($integer, $argument) = @_; |
11
|
3
|
|
|
|
|
153
|
return [reverse $argument..$integer]; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub eq { |
15
|
12
|
|
|
12
|
0
|
20
|
my ($integer, $argument) = @_; |
16
|
12
|
100
|
|
|
|
178
|
return $integer == $argument ? 1 : 0; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub gt { |
20
|
6
|
|
|
6
|
0
|
13
|
my ($integer, $argument) = @_; |
21
|
6
|
100
|
|
|
|
160
|
return $integer > $argument ? 1 : 0; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub gte { |
25
|
9
|
|
|
9
|
0
|
17
|
my ($integer, $argument) = @_; |
26
|
9
|
100
|
|
|
|
604
|
return $integer >= $argument ? 1 : 0; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub lt { |
30
|
6
|
|
|
6
|
0
|
12
|
my ($integer, $argument) = @_; |
31
|
6
|
100
|
|
|
|
158
|
return $integer < $argument ? 1 : 0; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub lte { |
35
|
9
|
|
|
9
|
0
|
18
|
my ($integer, $argument) = @_; |
36
|
9
|
100
|
|
|
|
182
|
return $integer <= $argument ? 1 : 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub ne { |
40
|
6
|
|
|
6
|
0
|
13
|
my ($integer, $argument) = @_; |
41
|
6
|
100
|
|
|
|
154
|
return $integer != $argument ? 1 : 0; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub to { |
45
|
9
|
|
|
9
|
0
|
17
|
my ($integer, $argument) = @_; |
46
|
9
|
100
|
|
|
|
342
|
return [$integer..$argument] if $integer <= $argument; |
47
|
3
|
|
|
|
|
12
|
return [reverse($argument..$integer)]; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub upto { |
51
|
3
|
|
|
3
|
0
|
6
|
my ($integer, $argument) = @_; |
52
|
3
|
|
|
|
|
155
|
return [$integer..$argument]; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |