Peter Rabbitson <mailto:[EMAIL PROTECTED]> wrote:
: Charles asked:
:
: : Can you show us your test cases script, so we can see
: : it fail?
:
: Certainly. It's a simple as:
:
: use Tools::Currency;
: my $one = Tools::Currency->new ('1');
: print ($one + 1);
:
: which yields:
:
: perl ./test
: Unknown round mode '' at ./test line 3
:
: Changing the two occurences of Tools::Currency to Math::Currency
: makes it work just fine
I think the problem is in the way Math::Currency handles
subclasses. I tried your example with the lines commented out
on your module and got the same result.
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;
So, the problem is in the subclassing, not your code. The
difference is in the class name. Look at Math::Currency::new()
to see what is happening when $class equals 'Tools::Currency'
instead of 'Math::Currency'.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>