Fix weird bug, caused by a double evaluation in ternary if
Daniel Ruoso [Mon, 14 Apr 2008 14:04:08 +0000 (14:04 +0000)]
lib/SQL/Translator.pm

index 890b3ca..4e34d0a 100644 (file)
@@ -536,8 +536,13 @@ sub translate {
     # Run producer
     # Calling wantarray in the eval no work, wrong scope.
     my $wantarray = wantarray ? 1 : 0;
-    eval { $wantarray ? @producer_output = $producer->($self) :
-               $producer_output = $producer->($self) };
+    eval {
+        if ($wantarray) {
+            @producer_output = $producer->($self);
+        } else {
+            $producer_output = $producer->($self);
+        }
+    };
     if ($@ || !( $producer_output || @producer_output)) {
         my $err = $@ || $self->error || "no results";
         my $msg = "translate: Error with producer '$producer_type': $err";