Interesting Error - Can't use string ("1909") as an ARRAY ref while "strict refs" in use

Rick Cooper rcooper at dwford.com
Tue Mar 10 23:08:43 GMT 2009


 

> -----Original Message-----
> From: mailscanner-bounces at lists.mailscanner.info 
> [mailto:mailscanner-bounces at lists.mailscanner.info] On Behalf 
> Of Julian Field
> Sent: Tuesday, March 10, 2009 3:59 PM
> To: MailScanner discussion
> Subject: Re: Interesting Error - Can't use string ("1909") as 
> an ARRAY ref while "strict refs" in use
> 
> 
> 
> On 10/3/09 18:58, Drew Marshall wrote:
> >
> > On 10 Mar 2009, at 17:55, Julian Field wrote:
> >>>
> >>> Julian, I believe you want for ($i=(@{$body}-1); $i>=0; $i--) { 
> >>> #decrement
> >>> not increment
> >>>
> >> Of course I do, well done for spotting the intentional error, just 
> >> making sure you guys are kept on your toes ;-)
> >
> > Ok, so I now have (For the purposes of the record):
> >
> > if ($configwords[1] =~ /tr[ua]/i) {
> >     my $i;
> >     for ($i=(@{$body}-1); $i>=0; $i--) {
> >       last if $body->[$i] =~ /^\s*$/i;
> >       pop @{$body};
> >     }
> >     $b->Done();
> >     return;
> >   }
> Correct.
> >
> > Which still works:
> >
> > MailScanner --debug
> > In Debugging mode, not forking...
> > Trying to setlogsock(unix)
> > Building a message batch to scan...
> > Have a batch of 1 message.
> > max message size is '250000 trackback'
> > commit ineffective with AutoCommit enabled at 
> > /etc/MailScanner/CustomFunctions/MailWatch.pm line 94, 
> <CLIENT> line 61.
> > Stopping now as you are debugging me.
> >
> > Still in production so tomorrow will give it a true test of 
> a few '000 
> > messages but I'm more than sure it will be fine (But then I 
> said that 
> > last time ;-) ).
> Oh, how I love working round bugs in Perl :-)
> Glad we got there in the end though, and the final code is a 
> lot simpler 
> to read than my first version too. I didn't do it this way 
> initially as 
> I don't like breaking out of "for" loops with "last", as that is what 
> the termination condition is for.
> 
> But it works, and that's the most important bit!
> 
> Jules
> 

When/If that is a confirmed fix you might want to apply it to SMDiskStore.pm
as well as it appears to share the same original trackback code

Rick


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the MailScanner mailing list