[ Robin Findlay writes: ]
>
> The symptom is that the pre-recorded message is sent to the subscriber
> as mail but new-list bombs out at line 72, and will not send back the
> user their original message. line 72 does a tr/A-Z/a-z in the output
> stream.
New-list apparently hasn't been Perl5-ized yet. Here's the context of
the code in question:
70 foreach ("From", "To", "Cc", "Subject", "Date", "Message-ID") {
71 $tag = $_;
72 tr/A-Z/a-z/;
73 if (defined($hdrs{$_})) {
74 print MAIL $tag, ": ", $hdrs{$_}, "\n";
75 }
76 }
The problem is that 'for' loops use a localized variable ($_ in this
case) as a reference to the list being iterated over. In this case the
list is a list of "constant" literal strings. Perl5 catches attempts to
modify literals, whereas Perl4 didn't. All that's needed is to copy the
item being modified. Here's what I'd suggest to fix this loop:
70 foreach ("From", "To", "Cc", "Subject", "Date", "Message-ID") {
72 ($hdr = $_) =~ tr/A-Z/a-z/;
73 if (defined($hdrs{$hdr})) {
74 print MAIL $_, ": ", $hdrs{$hdr}, "\n";
75 }
76 }
--
Dave Wolfe *Not a spokesman for Motorola* (512) 891-3246
Motorola MMTG 6501 Wm. Cannon Dr. W. OE112 Austin TX 78735-8598
References:
|
|