X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fbigrat.pm;h=a7a2c437b4a69a79c2476d0271e4c20aff65e724;hb=bd49aa0990860b27ed774e78523caa0fd4824ceb;hp=f326e23316a4dcbc1cec1bf6b760012be191ee1e;hpb=e3b7d412e225646739735ee08e98041e0278f7bf;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/bigrat.pm b/lib/bigrat.pm index f326e23..a7a2c43 100644 --- a/lib/bigrat.pm +++ b/lib/bigrat.pm @@ -1,7 +1,7 @@ package bigrat; use 5.006002; -$VERSION = '0.09'; +$VERSION = '0.10'; require Exporter; @ISA = qw( Exporter ); @EXPORT_OK = qw( ); @@ -80,7 +80,7 @@ sub import # see also bignum->import() for additional comments # some defaults - my $lib = ''; my $upgrade = 'Math::BigFloat'; + my $lib = ''; my $lib_kind = 'try'; my $upgrade = 'Math::BigFloat'; my @import = ( ':constant' ); # drive it w/ constant my @a = @_; my $l = scalar @_; my $j = 0; @@ -95,9 +95,10 @@ sub import my $s = 2; $s = 1 if @a-$j < 2; # avoid "can not modify non-existant..." splice @a, $j, $s; $j -= $s; } - elsif ($_[$i] =~ /^(l|lib)$/) + elsif ($_[$i] =~ /^(l|lib|try|only)$/) { # this causes a different low lib to take care... + $lib_kind = $1; $lib_kind = 'lib' if $lib_kind eq 'l'; $lib = $_[$i+1] || ''; my $s = 2; $s = 1 if @a-$j < 2; # avoid "can not modify non-existant..." splice @a, $j, $s; $j -= $s; $i++; @@ -152,7 +153,7 @@ sub import require Math::BigInt if $_lite == 0; # not already loaded? $class = 'Math::BigInt'; # regardless of MBIL or not } - push @import, 'lib' => $lib if $lib ne ''; + push @import, $lib_kind => $lib if $lib ne ''; # Math::BigInt::Trace or plain Math::BigInt $class->import(@import, upgrade => $upgrade); @@ -229,13 +230,23 @@ Math::BigInt::Calc. This is equivalent to saying: You can change this by using: - use bigrat lib => 'BitVect'; + use bignum lib => 'GMP'; The following would first try to find Math::BigInt::Foo, then Math::BigInt::Bar, and when this also fails, revert to Math::BigInt::Calc: use bigrat lib => 'Foo,Math::BigInt::Bar'; +Using C warns if none of the specified libraries can be found and +L did fall back to one of the default libraries. +To supress this warning, use C instead: + + use bignum try => 'GMP'; + +If you want the code to die instead of falling back, use C instead: + + use bignum only => 'GMP'; + Please see respective module documentation for further details. =head2 Sign