nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] [exmh-workers] Second release candidate for nmh 1.5 is now available

2012-05-14 20:41:50
$_ is a special global, you lexicalize these with local not my,
especially if you want to be backwards compatible ;-)

Although 5.8 is a bit old, it's still common and has good Unicode
support, therefore as long as the changes to support are minimal
I suggest it is well worth doing.

Sounds good to me ... if that's all it takes to make it work, then
that's easy.  But I think to be more correct those lines should
really be:

        local $_ = shift;
        my $boundary = shift;

Right?

Actually ... looking at that subroutine, I realize that I don't even need
to use $_ at all.  That's left over from a version where I tried to use
a regex operator for line matching, and I guess I get what I deserve
trying to be clever.  How about this patch?

--Ken
diff --git a/docs/contrib/replyfilter b/docs/contrib/replyfilter
index 2e98794..8e591bd 100755
--- a/docs/contrib/replyfilter
+++ b/docs/contrib/replyfilter
@@ -661,15 +661,15 @@ sub null_decoder ($)
 
 sub match_boundary($$)
 {
-       my ($_, $boundary) = @_;
+       my ($line, $boundary) = @_;
 
        return if ! defined $boundary;
 
-       if (substr($_, 0, 2) eq '--') {
-               s/[ \t\r\n]+\Z//;
-               if ($_ eq "--$boundary") {
+       if (substr($line, 0, 2) eq '--') {
+               $line =~ s/[ \t\r\n]+\Z//;
+               if ($line eq "--$boundary") {
                        return 'EOP';
-               } elsif ($_ eq "--$boundary--") {
+               } elsif ($line eq "--$boundary--") {
                        return 'EOM';
                }
        }
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers
<Prev in Thread] Current Thread [Next in Thread>