[interchange-cvs] interchange - heins modified lib/Vend/Util.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Sat Mar 1 10:40:01 2003


User:      heins
Date:      2003-03-01 15:39:16 GMT
Modified:  lib/Vend Util.pm
Log:
* Fix round_to_frac_digits() so it handles numbers that don't have a
  pre-existing decimal point.

Revision  Changes    Path
2.51      +4 -4      interchange/lib/Vend/Util.pm


rev 2.51, prev_rev 2.50
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.50
retrieving revision 2.51
diff -u -r2.50 -r2.51
--- Util.pm	13 Feb 2003 10:23:08 -0000	2.50
+++ Util.pm	1 Mar 2003 15:39:16 -0000	2.51
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.50 2003/02/13 10:23:08 racke Exp $
+# $Id: Util.pm,v 2.51 2003/03/01 15:39:16 mheins Exp $
 # 
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -85,7 +85,7 @@
 use Safe;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.50 $, 10);
+$VERSION = substr(q$Revision: 2.51 $, 10);
 
 my $Eval_routine;
 my $Eval_routine_file;
@@ -258,10 +258,10 @@
 		$digits = 2;
 	}
 	my @frac;
-	$num =~ /^(\d*)\.(\d+)$/
+	$num =~ /^(\d*)(?:\.(\d+))*$/
 		or return $num;
 	my $int = $1;
-	@frac = split //, $2;
+	@frac = split(//, ($2 || 0));
 	local($^W) = 0;
 	my $frac = join "", @frac[0 .. $digits - 1];
 	if($frac[$digits] > 4) {