Home > Archive > PERL Beginners > October 2005 > Re: Module subclassing (solved)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Module subclassing (solved)
|
|
| Peter Rabbitson 2005-10-24, 6:56 pm |
| > I am trying to subclass Math::Currency to change the default bstr() and
> move it to a different function, so my numbers are not formatted by
> default (I am unable to just strip existing formatting in a certain
> situation).
> ...
> However any arithmetics fails with an "Unknown round mode ''" error.
Crap, it was all written in the POD of Math::BigInt under Subclassing.
Adding the following globals to the class package solved the problem:
our $accuracy = undef;
our $precision = -2;
our $round_mode = 'even';
our $div_scale = 40;
| |
| Jeff 'japhy' Pinyan 2005-10-24, 6:56 pm |
| On Oct 24, Peter Rabbitson said:
>
> Crap, it was all written in the POD of Math::BigInt under Subclassing.
> Adding the following globals to the class package solved the problem:
>
> our $accuracy = undef;
> our $precision = -2;
> our $round_mode = 'even';
> our $div_scale = 40;
That's poor planning, in my opinion. Those should be set up as methods of
the object. :(
The idiom:
package Class::Subclass;
use base 'Class';
1;
should be universal, no?
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://www.perlmonks.org/ % have long ago been overpaid?
http://princeton.pm.org/ % -- Meister Eckhart
|
|
|
|
|