diff options
author | mertz | 2005-06-23 17:09:49 +0000 |
---|---|---|
committer | mertz | 2005-06-23 17:09:49 +0000 |
commit | 2be444cc5f0e80da7ee0f2d75e0bbe6b838b90f6 (patch) | |
tree | 5fd9d59808f7a2fea3a97e3fcd7aa85b5cce75b0 /Perl/Zinc | |
parent | 8bdb1c814697575e1f00f22ce4b5764d740d0290 (diff) | |
download | tkzinc-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.pm | 15 |
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]/ |