Subject: | Fix $_ localization |
A few functions in MIME-tools-5.417 still clobber $_.
Please use 'local $_' in these functions (see the attached patch).
--
Alexey Tourbin
ALT Linux Team
--- MIME-tools-5.417/lib/MIME/Decoder/BinHex.pm- 2005-01-13 22:23:15 +0300
+++ MIME-tools-5.417/lib/MIME/Decoder/BinHex.pm 2005-05-12 17:54:21 +0400
@@ -57,7 +57,6 @@ sub decode_it {
my ($self, $in, $out) = @_;
my ($mode, $file);
my (@preamble, @data);
- local $_;
my $H2B = Convert::BinHex->hex2bin;
my $line;
@@ -66,6 +65,7 @@ sub decode_it {
$self->{MDU_File} = undef;
### Find beginning...
+ local $_;
while (defined($_ = $in->getline)) {
if (/^\(This file must be converted/) {
$_ = $in->getline;
--- MIME-tools-5.417/lib/MIME/Decoder/UU.pm- 2005-01-13 22:23:15 +0300
+++ MIME-tools-5.417/lib/MIME/Decoder/UU.pm 2005-05-12 17:56:05 +0400
@@ -60,7 +60,6 @@ sub decode_it {
my ($self, $in, $out) = @_;
my ($mode, $file);
my @preamble;
- local $_;
### Init:
$self->{MDU_Preamble} = \@preamble;
@@ -68,6 +67,7 @@ sub decode_it {
$self->{MDU_File} = undef;
### Find beginning...
+ local $_;
while (defined($_ = $in->getline)) {
if (/^begin(.*)/) { ### found it: now decode it...
my $modefile = $1;
--- MIME-tools-5.417/lib/MIME/Decoder/QuotedPrint.pm- 2005-01-13 22:23:15 +0300
+++ MIME-tools-5.417/lib/MIME/Decoder/QuotedPrint.pm 2005-05-12 17:48:50 +0400
@@ -108,7 +108,7 @@ sub decode_it {
my ($self, $in, $out) = @_;
my $init = 0;
my $badpdf = 0;
-
+ local $_;
while (defined($_ = $in->getline)) {
#
# Dirty hack to fix QP-Encoded PDFs from MS-Outlook.
@@ -147,7 +147,7 @@ sub decode_it {
#
sub encode_it {
my ($self, $in, $out, $textual_type) = @_;
-
+ local $_;
while (defined($_ = $in->getline)) {
$out->print(encode_qp_really($_, $textual_type));
}
--- MIME-tools-5.417/lib/MIME/Body.pm- 2005-01-13 22:23:15 +0300
+++ MIME-tools-5.417/lib/MIME/Body.pm 2005-05-12 17:46:13 +0400
@@ -191,6 +191,7 @@ sub as_lines {
my $self = shift;
my @lines;
my $io = $self->open("r") || return ();
+ local $_;
push @lines, $_ while (defined($_ = $io->getline()));
$io->close;
@lines;
--- MIME-tools-5.417/lib/MIME/Entity.pm- 2005-01-13 22:23:15 +0300
+++ MIME-tools-5.417/lib/MIME/Entity.pm 2005-05-12 17:50:53 +0400
@@ -1447,6 +1447,7 @@ sub suggest_encoding {
if ($IO = $self->bodyhandle->open("r")) {
### Scan message for 7bit-cleanliness:
+ local $_;
while (defined($_ = $IO->getline)) {
last if ($unclean = ((length($_) > 999) or /[\200-\377]/));
}
--- MIME-tools-5.417/lib/MIME/Decoder.pm- 2005-01-13 22:23:15 +0300
+++ MIME-tools-5.417/lib/MIME/Decoder.pm 2005-05-12 17:47:54 +0400
@@ -598,7 +598,7 @@ encoding:
### decode_it - the private decoding method
sub decode_it {
my ($self, $in, $out) = @_;
-
+ local $_;
while (defined($_ = $in->getline)) {
my $decoded = decode_qp($_);
$out->print($decoded);