File Coverage

blib/lib/Math/BigFloat/Constant.pm
Criterion Covered Total %
statement 18 24 75.0
branch 2 6 33.3
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 28 38 73.6


line stmt bran cond sub pod time code
1             # -*- mode: perl; -*-
2              
3             package Math::BigFloat::Constant;
4              
5 2     2   271388 use strict;
  2         5  
  2         83  
6 2     2   11 use warnings;
  2         10  
  2         188  
7              
8             our $VERSION = '1.16';
9              
10 2     2   3167 use Math::BigFloat;
  2         234639  
  2         12  
11             our @ISA = qw( Math::BigFloat );
12              
13 2     2   78294 use overload; # inherit from Math::BigFloat
  2         9  
  2         18  
14              
15             ##############################################################################
16             # We Are a True Math::BigFloat, But Thou Shallst Not Modify Us
17              
18             sub modify {
19 60     60 1 196265 my ($self, $method) = @_;
20              
21 60 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 60         261 die("Can not modify ", ref($self), " $self via $method()\n");
32             }
33              
34             ##############################################################################
35             # But cloning us creates a modifiable Math::BigFloat, so that overload works
36              
37             sub copy {
38 15     15 1 376831 my $x = shift;
39              
40 15 50       56 return Math::BigFloat->new($x) unless ref($x);
41 15         62 Math::BigFloat->copy($x);
42             }
43              
44             1;
45              
46             __END__