aboutsummaryrefslogtreecommitdiff
path: root/Perl/Zinc
diff options
context:
space:
mode:
authormertz2005-06-23 17:09:49 +0000
committermertz2005-06-23 17:09:49 +0000
commit2be444cc5f0e80da7ee0f2d75e0bbe6b838b90f6 (patch)
tree5fd9d59808f7a2fea3a97e3fcd7aa85b5cce75b0 /Perl/Zinc
parent8bdb1c814697575e1f00f22ce4b5764d740d0290 (diff)
downloadtkzinc-2be444cc5f0e80da7ee0f2d75e0bbe6b838b90f6.zip
tkzinc-2be444cc5f0e80da7ee0f2d75e0bbe6b838b90f6.tar.gz
tkzinc-2be444cc5f0e80da7ee0f2d75e0bbe6b838b90f6.tar.bz2
tkzinc-2be444cc5f0e80da7ee0f2d75e0bbe6b838b90f6.tar.xz
correction of TraceUtils to avoid test error on (some?) windows plateform
where 1.2e+34 may appear as 1.2e+034
Diffstat (limited to 'Perl/Zinc')
-rw-r--r--Perl/Zinc/TraceUtils.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/Perl/Zinc/TraceUtils.pm b/Perl/Zinc/TraceUtils.pm
index 8a3bc76..95327ce 100644
--- a/Perl/Zinc/TraceUtils.pm
+++ b/Perl/Zinc/TraceUtils.pm
@@ -42,11 +42,16 @@ sub Item {
return "'$value'";
} elsif ($ref eq '') { # scalar
if (defined $value) {
- if ($value =~ /^-?\d+(\.\d*(e[+-]?\d+)?)?$/ or # -1. or 1.0
- $value =~ /^-[a-zA-Z]([\w])*$/ # -option1 or -option-1
- ) {
- return $value;
- } elsif ($value eq ''
+ if ($value =~ /^-[a-zA-Z]([\w])*$/) { # -option1 or -option-1
+ return $value;
+ } elsif ($value =~ /^-?\d+(\.\d*(e[+-]?\d+)?)?$/) { # -1. or 1.0 or -1.2e+22 or 1.02e+034
+ if ($value =~ /(.*[-+]e)0+(\d+)/) { # removing the 0 after e+ or e-
+ return $1.$2;
+ } else {
+ return $value;
+ }
+ }
+ } elsif ($value eq ''
or $value =~ /\s/
or $value =~ /^[a-zA-Z]/
or $value =~ /^[\W]/