line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::LifeUniverseEverything; |
2
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
23717
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
5
|
1
|
|
|
1
|
|
1810
|
use overload; |
|
1
|
|
|
|
|
1188
|
|
|
1
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my %ops; |
8
|
71
|
|
|
71
|
|
2708
|
$ops{'0+'} = $ops{'""'} = sub { ${ $_[0] } }; |
|
71
|
|
|
|
|
2974
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$ops{'*'} = sub { |
11
|
5
|
100
|
66
|
5
|
|
158
|
my $val = (($_[0]==6 && $_[1]==9) || ($_[0]==9 && $_[1]==6)) |
12
|
|
|
|
|
|
|
? 42 |
13
|
|
|
|
|
|
|
: ("$_[0]" * $_[1]); |
14
|
5
|
|
|
|
|
15
|
Acme::LifeUniverseEverything->new($val); |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
for (qw( + - / % ** & | ^ )) { |
18
|
0
|
0
|
|
0
|
|
0
|
$ops{$_} = eval qq! sub { |
|
11
|
100
|
|
|
|
43
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
4
|
100
|
|
|
|
15
|
|
|
0
|
0
|
|
|
|
0
|
|
|
5
|
100
|
|
|
|
22
|
|
|
0
|
0
|
|
|
|
0
|
|
19
|
|
|
|
|
|
|
Acme::LifeUniverseEverything->new( |
20
|
|
|
|
|
|
|
\$_[2] ? ((0+\$_[1]) $_ "\$_[0]") |
21
|
|
|
|
|
|
|
: ("\$_[0]" $_ (0+\$_[1])) |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
} !; |
24
|
|
|
|
|
|
|
# $ops{$_ . '='} = eval qq! sub { |
25
|
|
|
|
|
|
|
# \$\$_[0] = "\$_[0]" $_ \$_[1]; |
26
|
|
|
|
|
|
|
# } !; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
5
|
|
|
5
|
|
2585
|
$ops{neg} = sub { Acme::LifeUniverseEverything->new( 0-("$_[0]") ); }; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$ops{$_} = eval qq ! sub { |
32
|
|
|
|
|
|
|
\$_[2] ? (\$_[1] $_ "\$_[0]") |
33
|
|
|
|
|
|
|
: ("\$_[0]" $_ \$_[1]); |
34
|
35
|
100
|
|
35
|
|
847
|
} ! for qw( <=> ); # << >> !< <= > >= == != <=> ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$ops{$_} = eval qq ! sub { $_("\$_[0]"); } ! |
37
|
0
|
|
|
0
|
|
0
|
for qw( ~ ! cos sin exp log sqrt ); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
2
|
|
4
|
$ops{abs} = sub { Acme::LifeUniverseEverything->new( abs("$_[0]") ); }; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# $ops{atan2} = sub { $_[2] ? atan2($_[1], "$_[0]") : atan2("$_[0]", $_[1]) }; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub import { |
45
|
1
|
|
|
1
|
|
15
|
overload->import(%ops); |
46
|
|
|
|
|
|
|
overload::constant |
47
|
40
|
|
|
40
|
|
128
|
integer => sub { Acme::LifeUniverseEverything->new(shift) }, |
48
|
1
|
|
|
0
|
|
201
|
binary => sub { Acme::LifeUniverseEverything->new(shift) }; |
|
0
|
|
|
|
|
0
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub new { |
52
|
72
|
|
|
72
|
0
|
110
|
my ($pkg, $val) = @_; |
53
|
72
|
|
|
|
|
1320
|
bless \$val, $pkg; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |