| 1 | 53 | ▶ | use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | package Lingy::Number; | ||||||||||
| 3 | |||||||||||
| 4 | 53 | ▶ | use Lingy::Common; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 53 | ▶ | use base 'Lingy::ScalarClass'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | use overload | ||||||||||
| 8 | 1079 | ▶ | '""' => sub { 0 + ${$_[0]} }, | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 53 | '+' => \&add, | |||||||||
| 10 | '-' => \&subtract, | ||||||||||
| 11 | '*' => \&multiply, | ||||||||||
| 12 | '/' => \÷, | ||||||||||
| 13 | '==' => \&equal_to, | ||||||||||
| 14 | '>' => \&greater_than, | ||||||||||
| 15 | '>=' => \&greater_equal, | ||||||||||
| 16 | '<' => \&less_than, | ||||||||||
| 17 | '<=' => \&less_equal, | ||||||||||
| 18 | '%' => \&modulo, | ||||||||||
| 19 | cmp => \&comp_pair, | ||||||||||
| 20 | 53 | ; | |||||||||
| 21 | |||||||||||
| 22 | 2 | ▶ | sub cast { | ||||||||
|
Subroutine
cast: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 23 | 2 | $_[1]; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub equal_to { | ||||||||
|
Subroutine
equal_to: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 27 | 0 | my ($x, $y) = @_; | |||||||||
| 28 | 0 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 0 | BOOLEAN->new($x == $y); | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 677 | ▶ | sub greater_than { | ||||||||
|
Subroutine
greater_than: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 34 | 677 | my ($x, $y) = @_; | |||||||||
| 35 | 677 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 677 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 677 | BOOLEAN->new($x > $y); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 248 | ▶ | sub greater_equal { | ||||||||
|
Subroutine
greater_equal: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||
| 41 | 248 | my ($x, $y) = @_; | |||||||||
| 42 | 248 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 248 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 248 | BOOLEAN->new($x >= $y); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 247 | ▶ | sub less_than { | ||||||||
|
Subroutine
less_than: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||
| 48 | 247 | my ($x, $y) = @_; | |||||||||
| 49 | 247 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 247 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 247 | BOOLEAN->new($x < $y); | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 23 | ▶ | sub less_equal { | ||||||||
|
Subroutine
less_equal: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||
| 55 | 23 | my ($x, $y) = @_; | |||||||||
| 56 | 23 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 23 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 23 | BOOLEAN->new($x <= $y); | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 10151 | ▶ | sub add { | ||||||||
|
Subroutine
add: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 62 | 10151 | my ($x, $y) = @_; | |||||||||
| 63 | 10151 | my $class = ref($x); | |||||||||
| 64 | 10151 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | 10151 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 10151 | $class->new($x + $y); | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 20075 | ▶ | sub subtract { | ||||||||
|
Subroutine
subtract: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 70 | 20075 | my ($x, $y) = @_; | |||||||||
| 71 | 20075 | my $class = ref($x); | |||||||||
| 72 | 20075 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 73 | 20075 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 74 | 20075 | $class->new($x - $y); | |||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | 25 | ▶ | sub multiply { | ||||||||
|
Subroutine
multiply: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 78 | 25 | my ($x, $y) = @_; | |||||||||
| 79 | 25 | my $class = ref($x); | |||||||||
| 80 | 25 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 81 | 25 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 82 | 25 | $class->new($x * $y); | |||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | 27 | ▶ | sub divide { | ||||||||
|
Subroutine
divide: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||
| 86 | 27 | my ($x, $y) = @_; | |||||||||
| 87 | 27 | my $class = ref($x); | |||||||||
| 88 | 27 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 89 | 27 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 90 | 27 | $class->new($x / $y); | |||||||||
| 91 | } | ||||||||||
| 92 | |||||||||||
| 93 | 134 | ▶ | sub modulo { | ||||||||
|
Subroutine
modulo: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||
| 94 | 134 | my ($x, $y) = @_; | |||||||||
| 95 | 134 | my $class = ref($x); | |||||||||
| 96 | 134 | ▶ | $x = ref($x) ? $$x : $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 97 | 134 | ▶ | $y = ref($y) ? $$y : $y; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 98 | 134 | $class->new($x % $y); | |||||||||
| 99 | } | ||||||||||
| 100 | |||||||||||
| 101 | 53 | 1; | |||||||||