Hi list,
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).
Here is what I did:
package Tools::Currency;
use base qw(Math::Currency);
use overload '""' => \&bstr;
sub bstr {
my $self = shift;
return (Math::BigFloat::bstr ($self));
}
sub fmtstr {
my $self = shift;
return (Math::Currency::bstr ($self));
}
1;
And all is well if I create a new number and print it back, both bstr()
and fmtstr() work just as expected. However any arithmetics fails with
an "Unknown round mode ''" error. I looked at Math::Currency which
is a rather simple module and I still can't figure out what am I doing
wrong.
Please help :)
Peter
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>