Great Circle Associates Majordomo-Workers
(February 1996)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: Re: Problems with new-list
From: Dave Wolfe <dwolfe @ risc . sps . mot . com>
Date: Mon, 12 Feb 1996 09:29:54 -0600 (CST)
To: c0robfin @ cecomm . co . uk (Robin Findlay)
Cc: uunet!greatcircle . com!majordomo-workers @ uunet . uu . net, cwilson @ slurp . neu . sgi . com (Chan Wilson)
In-reply-to: <9602120933.aa20121@cecomm.cecomm.co.uk> from "Robin Findlay" at Feb 12, 96 09:33:26 am
Reply-to: Dave Wolfe <david_wolfe @ risc . sps . mot . com>

[ 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:
Indexed By Date Previous: (Fwd) Returned mail: too many hops 26 (25 max): from <owner-computergram-eurosgi@eurohub.neu.sgi.com> via sgistk1.stockholm.sgi.com, to <andre@stockholm.sgi.com>
From: "Rachel Haag" <rachel@dingo.neu.sgi.com>
Next: Bill Gates ListServ Spam (another!)
From: Brian Fleming <brianf@microsoft.com>
Indexed By Thread Previous: Problems with new-list
From: Robin Findlay <c0robfin@cecomm.co.uk>
Next: (Fwd) Returned mail: too many hops 26 (25 max): from <owner-computergram-eurosgi@eurohub.neu.sgi.com> via sgistk1.stockholm.sgi.com, to <andre@stockholm.sgi.com>
From: "Rachel Haag" <rachel@dingo.neu.sgi.com>

Google
 
Search Internet Search www.greatcircle.com