Author: spadkins
Date: Tue May 29 12:33:21 2007
New Revision: 9621

Modified:
   p5ee/trunk/App-Repository/lib/App/Repository.pm

Log:
fix evaluate_constant_expression() for div 0 and sci notation

Modified: p5ee/trunk/App-Repository/lib/App/Repository.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository.pm     (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository.pm     Tue May 29 12:33:21 2007
@@ -3391,7 +3391,7 @@
 sub evaluate_constant_expression {
     &App::sub_entry if ($App::trace);
     my ($self, $value) = @_;
-    my $NUM = '-?[0-9\.]+';
+    my $NUM = '-?[0-9\.]+(?:[eE][+-]?[0-9]+)?';
 
     my ($val);
     while ($value =~ /\(([^()]*)\)/) {
@@ -3404,7 +3404,7 @@
     if ($value =~ m!^[-\+\*/0-9\.\s]+$!) {  # all numeric expression
         $value =~ s/\s+//g;
     }
-    while ($value =~ s~($NUM)\s*([\*/])\s*($NUM)~(!defined $1 || !defined $3) 
? "undef" : (($2 eq "*") ? ($1 * $3) : ($3 ? ($1 / $3) : "undef"))~e) {
+    while ($value =~ s~($NUM)\s*([\*/])\s*($NUM)~(!defined $1 || !defined $3) 
? "undef" : (($2 eq "*") ? ($1 * $3) : (($3 && $3 != 0.0) ? ($1 / $3) : 
"undef"))~e) {
         #print "EXPR: $1 $2 $3 = $value\n";
         # nothing else needed
     }

Reply via email to