209aa1df9d1dd7376e5da6dfa702e9bdb441ba65
[p5sagit/p5-mst-13.2.git] / t / lib / Math / BigFloat / Subclass.pm
1 #!/usr/bin/perl -w
2
3 package Math::BigFloat::Subclass;
4
5 require 5.005_02;
6 use strict;
7
8 use Exporter;
9 use Math::BigFloat(1.23);
10 use vars qw($VERSION @ISA $PACKAGE
11             $accuracy $precision $round_mode $div_scale);
12
13 @ISA = qw(Exporter Math::BigFloat);
14
15 $VERSION = 0.01;
16
17 # Globals
18 $accuracy = $precision = undef;
19 $round_mode = 'even';
20 $div_scale = 40;
21
22 sub new
23 {
24         my $proto  = shift;
25         my $class  = ref($proto) || $proto;
26
27         my $value       = shift;
28         # Set to 0 if not provided, but don't use || (this would trigger for
29         # a passed objects to see if they are zero)
30         $value  = 0 if !defined $value;   
31
32         # Store the floating point value
33         my $self = bless Math::BigFloat->new($value), $class;
34         $self->{'_custom'} = 1; # make sure this never goes away
35         return $self;
36 }
37
38 1;