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

Rick Cooper rcooper at dwford.com
Sat Mar 7 16:55:11 GMT 2009


 

 > -----Original Message-----
 > From: mailscanner-bounces at lists.mailscanner.info 
 > [mailto:mailscanner-bounces at lists.mailscanner.info] On 
 > Behalf Of Rick Cooper
 > Sent: Saturday, March 07, 2009 11:41 AM
 > To: 'MailScanner discussion'
 > Subject: RE: Interesting Error - Can't use string ("1909") 
 > as an ARRAYrefwhile "strict refs" in use
 > 
 >  
 > 
 >  > -----Original Message-----
 >  > From: mailscanner-bounces at lists.mailscanner.info 
 >  > [mailto:mailscanner-bounces at lists.mailscanner.info] On 
 >  > Behalf Of Rick Cooper
 >  > Sent: Saturday, March 07, 2009 11:30 AM
 >  > To: 'MailScanner discussion'
 >  > Subject: RE: Interesting Error - Can't use string ("1909") 
 >  > as an ARRAY refwhile "strict refs" in use
 >  > 
 >  >  
 >  > 
 >  >  > -----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
 >  > 
 > 
 > 
 > MAJOR Typo there, the pop @{$#Bodyref}; SHOULD BE pop @{$Bodyref};
 > Forgot to pull the # out when I copy pasted, sorry. 
 > 
 > 
 >  >     my $Bodyref = \@body;
 >  > 
 >  >     while (${@{$body}}[$#Bodyref] !~ /^\s*$/) {
 >  >       print "Line is ****" . ${@{$body}}[$#Bodyref] . "****\n";
 >  >       pop @{$#Bodyref};
 >  >       #print STDERR ".";
 >  >     }
 >  > 
 >  > 
 >  > 
 > 


Actually, now that I think about it (if I am correctly reading into what
this is supposed to do), I would think

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

Would work just as well would it not?

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