--As of June 13, 2014 8:21:50 AM -0400, Joe Quinn is alleged to have said:

On 6/12/2014 10:27 PM, Tom Robinson wrote:
Hi,

Sorry to bother you with this. As referenced on the ApacheSpamAssassin
Wiki for AutoWhiteList
(https://wiki.apache.org/spamassassin/AutoWhitelist) I downloaded the
Truxoft version of the sa-heatu utility
(http://truxoft.com/resources/sa-heatu.v4.02.tar.gz ) but when I run it
I get these errors:

Bareword found where operator expected at /usr/local/bin/sa-heatu line
227, near "s/... //r" Bareword found where operator expected at
/usr/local/bin/sa-heatu line 227, near "s/:.. / /r" syntax error at
/usr/local/bin/sa-heatu line 227, near "s/... //r " Execution of
/usr/local/bin/sa-heatu aborted due to compilation errors.

I'm running a CentOS 5.10, 32bit system.

My version of perl is:
# perl -version
This is perl, v5.8.8 built for i386-linux-thread-multi
---8<---snip*---

I fetched a version of sa-heatu from git hub as well but it is the same
file (diff shows no differences and I get the same errors when running).

Here is a snippet of the code in context:

224     if ($count && ($opt_verbose || ($opt_verboseHits &&
$count>$opt_verboseHits) || ($opt_showUpdates && $prtu))) {
225         printf $fmt, $totscore/$count, $totscore,$count, $email,
$ip, $reason; 226         if (!$opt_NoTimes && (($twas||0)!=0))
227             {printf "%s", ((localtime $twas) =~ s/... //r =~ s/:.. /
/r);}              # don't include d-o-w, and drop seconds as that
implies precision
228     }

Not being a perl expert I'm not sure exactly what is wrong here. Can
anyone please help determine the issue?

Kind regards,
Tom

/r is not a valid regex modifier, and gets parsed as a bareword - see
http://perldoc.perl.org/perlre.html#Modifiers

--As for the rest, it is mine.

That's not it: /r is a valid *substitution* modifier:

<http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators>

I'm not sure what the problem is though. It *looks* ok to me. It might be worth breaking line 227 into four lines just to see if that can show the problem better.

It should be equivalent to:

{
   my $temp = localtime $twas;
   $temp =~ s/:.. / /;
   $temp =~ s/... //;
   printf "%s", $temp;
}

(Note the /r is needed in the original because `localtime $twas` isn't something you can assign to.)

I'm not entirely certain on which order the strung-together substitutions are evaluated, or if it matters.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

Reply via email to