1N/A#!/usr/bin/perl -w
1N/A
1N/Apackage Math::BigInt::Subclass;
1N/A
1N/Arequire 5.005_02;
1N/Ause strict;
1N/A
1N/Ause Exporter;
1N/Ause Math::BigInt (1.64);
1N/A# $lib is for the "lib => " test
1N/Ause vars qw($VERSION @ISA $PACKAGE @EXPORT_OK
1N/A $lib
1N/A $accuracy $precision $round_mode $div_scale);
1N/A
1N/A@ISA = qw(Exporter Math::BigInt);
1N/A@EXPORT_OK = qw(bgcd objectify);
1N/A
1N/A$VERSION = 0.04;
1N/A
1N/Ause overload; # inherit overload from BigInt
1N/A
1N/A# Globals
1N/A$accuracy = $precision = undef;
1N/A$round_mode = 'even';
1N/A$div_scale = 40;
1N/A$lib = '';
1N/A
1N/Asub new
1N/A{
1N/A my $proto = shift;
1N/A my $class = ref($proto) || $proto;
1N/A
1N/A my $value = shift;
1N/A my $a = $accuracy; $a = $_[0] if defined $_[0];
1N/A my $p = $precision; $p = $_[1] if defined $_[1];
1N/A my $self = Math::BigInt->new($value,$a,$p,$round_mode);
1N/A bless $self,$class;
1N/A $self->{'_custom'} = 1; # make sure this never goes away
1N/A return $self;
1N/A}
1N/A
1N/Asub bgcd
1N/A {
1N/A Math::BigInt::bgcd(@_);
1N/A }
1N/A
1N/Asub blcm
1N/A {
1N/A Math::BigInt::blcm(@_);
1N/A }
1N/A
1N/ABEGIN
1N/A {
1N/A *objectify = \&Math::BigInt::objectify;
1N/A
1N/A # these are called by AUTOLOAD from BigFloat, so we need at least these.
1N/A # We cheat, of course..
1N/A *bneg = \&Math::BigInt::bneg;
1N/A *babs = \&Math::BigInt::babs;
1N/A *bnan = \&Math::BigInt::bnan;
1N/A *binf = \&Math::BigInt::binf;
1N/A *bzero = \&Math::BigInt::bzero;
1N/A *bone = \&Math::BigInt::bone;
1N/A }
1N/A
1N/Asub import
1N/A {
1N/A my $self = shift;
1N/A
1N/A my @a; my $t = 0;
1N/A foreach (@_)
1N/A {
1N/A # remove the "lib => foo" parameters and store it
1N/A $lib = $_, $t = 0, next if $t == 1;
1N/A if ($_ eq 'lib')
1N/A {
1N/A $t = 1; next;
1N/A }
1N/A push @a,$_;
1N/A }
1N/A $self->SUPER::import(@a); # need it for subclasses
1N/A $self->export_to_level(1,$self,@a); # need this ?
1N/A }
1N/A
1N/A1;