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

Rick Cooper rcooper at dwford.com
Sat Mar 7 16:30:03 GMT 2009


 

 > -----Original Message-----
 > From: mailscanner-bounces at lists.mailscanner.info 
 > [mailto:mailscanner-bounces at lists.mailscanner.info] On 
 > Behalf Of Ian McDonald
 > Sent: Saturday, March 07, 2009 7:43 AM
 > To: MailScanner discussion
 > Subject: Re: Interesting Error - Can't use string ("1909") 
 > as an ARRAY ref while "strict refs" in use
 > 
 > Drew Marshall wrote:
 > > 
 > > On 6 Mar 2009, at 19:55, Julian Field wrote:
 > > 
 > >> If it's complaining that int(1909) cannot be used as an 
 > array ref, 
 > >> then there's not a whole lot I can do.
 > > 
 > > :-(
 > > 
 > >> You could try changing the line to
 > >>   while (${@{$body}}[int(scalar(@{$body})-1)+0] !~ /^\s*$/) {
 > >> (i.e. add a "+0" to it) but there really isn't much more I can do.
 > >> Try the +0 and let me know if it helps at all.
 > > 
 > > Can't use string ("18") as an ARRAY ref while "strict 
 > refs" in use at 
 > > /usr/share/MailScanner//MailScanner/PFDiskStore.pm line 509.
 > > 
 > >> This is a nasty Perl bug.
 > > 
 > > :-((
 > > 
[..]

Been looking at this and really have no way to test because I don't use
postfix but try changing

    while (${@{$body}}[scalar(@{$body})-1] !~ /^\s*$/) {
      print "Line is ****" . ${@{$body}}[scalar(@{$body})-1] . "****\n";
      pop @{$body};
      #print STDERR ".";
    }

TO

    my $Bodyref = \@body;

    while (${@{$body}}[$#Bodyref] !~ /^\s*$/) {
      print "Line is ****" . ${@{$body}}[$#Bodyref] . "****\n";
      pop @{$#Bodyref};
      #print STDERR ".";
    }



--
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