line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# A Numeric Data Type Role for Perl 5 |
2
|
|
|
|
|
|
|
package Data::Object::Role::Numeric; |
3
|
|
|
|
|
|
|
|
4
|
150
|
|
|
150
|
|
171862
|
use 5.010; |
|
150
|
|
|
|
|
458
|
|
|
150
|
|
|
|
|
5719
|
|
5
|
150
|
|
|
150
|
|
741
|
use Data::Object::Role; |
|
150
|
|
|
|
|
261
|
|
|
150
|
|
|
|
|
973
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.20'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub downto { |
10
|
3
|
|
|
3
|
0
|
6
|
my ($integer, $argument) = @_; |
11
|
3
|
|
|
|
|
166
|
return [reverse $argument..$integer]; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub eq { |
15
|
12
|
|
|
12
|
0
|
21
|
my ($integer, $argument) = @_; |
16
|
12
|
100
|
|
|
|
238
|
return $integer == $argument ? 1 : 0; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub gt { |
20
|
6
|
|
|
6
|
0
|
12
|
my ($integer, $argument) = @_; |
21
|
6
|
100
|
|
|
|
258
|
return $integer > $argument ? 1 : 0; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub gte { |
25
|
9
|
|
|
9
|
0
|
13
|
my ($integer, $argument) = @_; |
26
|
9
|
100
|
|
|
|
242
|
return $integer >= $argument ? 1 : 0; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub lt { |
30
|
6
|
|
|
6
|
0
|
9
|
my ($integer, $argument) = @_; |
31
|
6
|
100
|
|
|
|
218
|
return $integer < $argument ? 1 : 0; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub lte { |
35
|
9
|
|
|
9
|
0
|
14
|
my ($integer, $argument) = @_; |
36
|
9
|
100
|
|
|
|
247
|
return $integer <= $argument ? 1 : 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub ne { |
40
|
6
|
|
|
6
|
0
|
10
|
my ($integer, $argument) = @_; |
41
|
6
|
100
|
|
|
|
202
|
return $integer != $argument ? 1 : 0; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub to { |
45
|
9
|
|
|
9
|
0
|
12
|
my ($integer, $argument) = @_; |
46
|
9
|
100
|
|
|
|
376
|
return [$integer..$argument] if $integer <= $argument; |
47
|
3
|
|
|
|
|
12
|
return [reverse($argument..$integer)]; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub upto { |
51
|
3
|
|
|
3
|
0
|
7
|
my ($integer, $argument) = @_; |
52
|
3
|
|
|
|
|
182
|
return [$integer..$argument]; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |