| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# -*- mode: perl; -*- |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Math::BigRat::Constant; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
132585
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
46
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
132
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.16'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1072
|
use Math::BigRat; |
|
|
1
|
|
|
|
|
104546
|
|
|
|
1
|
|
|
|
|
3
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw( Math::BigRat ); |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
21173
|
use overload; # inherit from Math::BigRat |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
############################################################################## |
|
16
|
|
|
|
|
|
|
# We Are a True Math::BigRat, But Thou Shallst Not Modify Us |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub modify { |
|
19
|
59
|
|
|
59
|
1
|
167669
|
my ($self, $method) = @_; |
|
20
|
|
|
|
|
|
|
|
|
21
|
59
|
50
|
|
|
|
196
|
unless (defined $method) { |
|
22
|
0
|
|
|
|
|
0
|
my @callinfo = caller(0); |
|
23
|
0
|
|
|
|
|
0
|
for (my $i = 1 ; ; ++$i) { |
|
24
|
0
|
|
|
|
|
0
|
my @next = caller($i); |
|
25
|
0
|
0
|
|
|
|
0
|
last unless @next; |
|
26
|
0
|
|
|
|
|
0
|
@callinfo = @next; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
0
|
|
|
|
|
0
|
$method = $callinfo[3]; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
59
|
|
|
|
|
287
|
die("Can not modify ", ref($self), " $self via $method()\n"); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
############################################################################## |
|
35
|
|
|
|
|
|
|
# But cloning us creates a modifiable Math::BigRat, so that overload works |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub copy { |
|
38
|
10
|
|
|
10
|
1
|
261358
|
my $x = shift; |
|
39
|
|
|
|
|
|
|
|
|
40
|
10
|
50
|
|
|
|
34
|
return Math::BigRat->new($x) unless ref($x); |
|
41
|
10
|
|
|
|
|
40
|
Math::BigRat->copy($x); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |