in reply to Re: Big Int to hex with 5.6
in thread Big Int to hex with 5.6

Well apparently not with win32 5.6 :

#!perl use strict ; use warnings; my $bignum = Math::BigInt->new('1111111111111111111111111'); $bignum->as_hex(); print $bignum ;

gives :

Can't locate object method "new" via package "Math::BigInt" (perhaps y +ou forgot to load "Math::BigInt"?) at t.pl line 4.

as_hex is not in the doc, either, but i indeed saw it with 5.8

Replies are listed 'Best First'.
Re^3: Big Int to hex with 5.6
by stajich (Chaplain) on Dec 12, 2004 at 21:19 UTC
    So you are using an older version of the module, you should upgrade the module if you want this functionality.
      no. it will run on a large number of machines and i have no possibility to upgrade them all, moreover for a single functionality.
        Then I would strongly encourage you to not use the module at all. IIRC, there was an initial attempt to convert the perl4 bigint facilities to a perl5 module that then languished in an incomplete and buggy state for years. Only lately has the module been maintained and improved (and made much faster). To quote the doc you linked to:
        BUGS The current version of this module is a preliminary version of the rea +l thing that is currently (as of perl5.002) under development.
        Seeing that 5.002 in 5.6 should give you a clue that nobody was bothering much about it for a long time.

        OTOH, if the bugs aren't biting you, they aren't biting you.

Re^3: Big Int to hex with 5.6
by ysth (Canon) on Dec 12, 2004 at 20:50 UTC
    There's an important clue in the error message: you need to use Math::Bigint; (or use bigint;). But if you aren't already doing that, what do you mean by a "bigint number"?

    Oh, I see; you perhaps are using the ancient decrepit perl4-ish bigint.pl; you are strongly advised to install a new version of Math::BigInt (which I believe includes a bigint.pm module also) which has scads of bug fixes and use it instead.

    You also should be doing print $bignum->as_hex();; just calling it in void context doesn't do anything.

      you perhaps are using the ancient decrepit perl4-ish bigint.pl

      I'm using active perl 5.6, and as far as i understand it as_hex is not in the methods offered : BigInt ActiveState

      Sadly upgrading is not an option here. How can do it ? I'm trying to divide by 16 as in a standard conversion but it doesn't work very well ...

Re^3: Big Int to hex with 5.6
by ZlR (Chaplain) on Dec 12, 2004 at 20:42 UTC
    err, sorry !

    Here it is :

    #!perl use strict ; use warnings; use Math::BigInt ; my $bignum = Math::BigInt->new('1111111111111111111111111'); $bignum->as_hex(); print $bignum ;
    gives
    Can't locate object method "as_hex" via package "Math::BigInt" (perhap +s you forgot to load "Math::BigInt"?) at t.pl line 6.