https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6312

--- Comment #3 from Adam Katz <[email protected]> 2010-01-29 11:54:38 UTC ---
http://svn.apache.org/viewvc/spamassassin/trunk/spamd/spamd.raw?r1=904526&r2=904525&pathrev=904526
has:

-  my $mail = $spamtest->parse(\...@msglines, 0, !$timeout_child ? () :
-                         { master_deadline => $start_time + $timeout_child }
);
+  my $mail = $spamtest->parse(\...@msglines, 0,
+                       !$timeout_child || !$start_time ? ()
+                       : { master_deadline => $start_time + $timeout_child }
);

I read that backwards at first glance, having missed the "() :" portion and
then wondering why this adds two potentially missing numbers.  I'm not as
firmly planted a perl developer as many others, but why not use the less
confusing negation,

-  my $mail = $spamtest->parse(\...@msglines, 0,
-                       !$timeout_child || !$start_time ? ()
-                       : { master_deadline => $start_time + $timeout_child }
);
+  my $mail = $spamtest->parse(\...@msglines, 0, $timeout_child && $start_time ?
+                       { master_deadline => $start_time + $timeout_child } :
() );

... ideally without the ternary operator,

-  my $mail = $spamtest->parse(\...@msglines, 0,
-                       !$timeout_child || !$start_time ? ()
-                       : { master_deadline => $start_time + $timeout_child }
);
+  my $mail = $spamtest->parse(\...@msglines, 0, $timeout_child && $start_time 
&&
+                       { master_deadline => $start_time + $timeout_child } );

... or since you'll probably object to that short-circuit nature,

-  my $mail = $spamtest->parse(\...@msglines, 0,
-                       !$timeout_child || !$start_time ? ()
-                       : { master_deadline => $start_time + $timeout_child }
);
+  my $mail = $spamtest->parse(\...@msglines, 0, 
+                       if ($timeout_child && $start_time)
+                       { master_deadline => $start_time + $timeout_child } );

etc.

-- 
Configure bugmail: 
https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to