Skip Menu |

This queue is for tickets about the Math-BigInt CPAN distribution.

Report information
The Basics
Id: 17447
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Math-BigInt

People
Owner: TELS [...] cpan.org
Requestors: mike.bidwell [...] jeppesen.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.77
Fixed in: (no value)



Subject: Can't call method Math::BigFloat->bsub, not a valid method
In the class Math::BigFloat when you have fsub called out in your program and it goes to Math::BigFloat to do the calculation it is suppossed to alias back to bsub. It corectly aliases but the $class variable is not correctly set to Math::BigInt where bsub sub-routine is declared at, it is trying to find the bsub routine in the Math::BigFloat module instead and since it is not there it fails out. Heres my code snippet: $sdate = new Math::BigFloat "365.25"; $mdate = new Math::BigFloat "30.6001"; $a = int($year/100); $b = int($a/4); $c = int((2 - $a)+$b); $e = int($sdate*($year + 4716)); $f = int($mdate*($mon + 1)); $cdate = ((($c+$day)+$e)+$f); $cdateStr = new Math::BigFloat( $cdate ); $cdateStr->fsub(1524); $cdateStr->fabs($cdateStr); And here is the code snippet out of Math::BigFloat: my $name = $AUTOLOAD; $name =~ s/(.*):://; # split package my $c = $1 || $class; no strict 'refs'; $c->import() if $IMPORT == 0; if (!method_alias($name)) { if (!defined $name) { # delayed load of Carp and avoid recursion require Carp; Carp::croak ("$c: Can't call a method without name"); } if (!method_hand_up($name)) { # delayed load of Carp and avoid recursion require Carp; Carp::croak ("Can't call $c\-\>$name, not a valid method"); } # try one level up, but subst. bxxx() for fxxx() since MBI only got bxxx() $name =~ s/^f/b/; return &{"Math::BigInt"."::$name"}(@_); } my $bname = $name; $bname =~ s/^f/b/; $c .= "::$name"; *{$c} = \&{$bname}; &{$c}; # uses @_ } The variable class is declared as thus: my $class = "Math::BigFloat"; at line 25 in the Math::BigFloat module. bsub is located in Math::BigInt at line 1130. Perl Version 5.8.7 is distributed with this. OS is Windows, Sun-Solaris, HP-Unix Thanks, Mike
Subject: Re: [rt.cpan.org #17447] Can't call method Math::BigFloat->bsub, not a valid method
Date: Thu, 2 Feb 2006 23:51:17 +0100
To: bug-Math-BigInt [...] rt.cpan.org
From: Tels <nospam-abuse [...] bloodgate.com>
Moin Mike, On Thursday 02 February 2006 22:07, Guest via RT wrote: Show quoted text
> Thu Feb 02 16:07:37 2006: Request 17447 was acted upon. > Transaction: Ticket created by guest > Queue: Math-BigInt > Subject: Can't call method Math::BigFloat->bsub, not a valid > method Owner: Nobody > Requestors: mike.bidwell@jeppesen.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=17447 > > > > In the class Math::BigFloat when you have fsub called out in your > program and it goes to Math::BigFloat to do the calculation it is > suppossed to alias back to bsub. It corectly aliases but the $class > variable is not correctly set to Math::BigInt where bsub sub-routine > is declared at, it is trying to find the bsub routine in the > Math::BigFloat module instead and since it is not there it fails out.
IIRC fsub() is there just for compatibility reasons, so it would be better to always use bsub() etc. I'llhave a look if I can fix this, but at the moment I have very little time for Math::BigInt and friends :/ best wishes, tels PS: Thanx for the report! -- Signed on Thu Feb 2 23:50:11 2006 with key 0x93B84C15. Visit my photo gallery at http://bloodgate.com/photos/ PGP key on http://bloodgate.com/tels.asc or per email. "Remember: If the game let's you do it, it's not cheating." -- Xarax
Download (untitled)
application/pgp-signature 481b

Message body not shown because it is not plain text.

I just released Math::BigInt 1.80 to CPAN, which fixes this issue. Thank you for your report, and sorry for the long delay.