From: dpvc v. a. <we...@ma...> - 2008-01-16 23:07:41
|
Log Message: ----------- Make sure Currency() actually returns a Currency object (it used to return a Real if one was passed to it). Modified Files: -------------- pg/macros: contextCurrency.pl Revision Data ------------- Index: contextCurrency.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/contextCurrency.pl,v retrieving revision 1.13 retrieving revision 1.14 diff -Lmacros/contextCurrency.pl -Lmacros/contextCurrency.pl -u -r1.13 -r1.14 --- macros/contextCurrency.pl +++ macros/contextCurrency.pl @@ -444,19 +444,19 @@ # produce an error message. # sub new { - my $self = shift; + my $self = shift; my $class = ref($self) || $self; my $context = (Value::isContext($_[0]) ? shift : $self->context); my $x = shift; Value::Error("Can't convert %s to a monitary value",lc(Value::showClass($x))) if !$self->getFlag("promoteReals",1) && Value::isRealNumber($x) && !Value::classMatch($x,"Currency"); - $self = $self->SUPER::new($context,$x,@_); + $self = bless $self->SUPER::new($context,$x,@_), $class; $self->{isReal} = $self->{isValue} = $self->{isCurrency} = 1; return $self; } sub make { - my $self = shift; - $self = $self->SUPER::make(@_); + my $self = shift; my $class = ref($self) || $self; + $self = bless $self->SUPER::make(@_), $class; $self->{isReal} = $self->{isValue} = $self->{isCurrency} = 1; return $self; } |