Subject: | Email::Folder::Mbox clobbers $_ |
Following program didn't work as expected:
(./mail_folders holds a bunch of mbox'es. Trying to find messages
without Message-IDs.)
find ./mail_folders/ -type f \
| perl -MEmail::Folder -lwe 'my $f = Email::Folder->new($_);
while (my $m = $f->next_message) {
next if $m->header("Message-ID");
print "$_\t".$m->header("Subject");
}'
$_ contained mbox /^From / lines, rather than the filename it should.
Attached patch fixes it. (Just localize $_ to the next_message method)
Subject: | Email-Folder.patch |
diff -ur Email-Folder-0.84/lib/Email/Folder/Mbox.pm Email-Folder-new/lib/Email/Folder/Mbox.pm
--- Email-Folder-0.84/lib/Email/Folder/Mbox.pm 2004-12-17 07:34:54.000000000 -0500
+++ Email-Folder-new/lib/Email/Folder/Mbox.pm 2006-03-02 22:14:03.452543500 -0500
@@ -131,6 +131,7 @@
my $inheaders = 1;
++$count;
print "$count starting scanning at line $.\n" if debug;
+ local $/;
while (<$fh>) {
if ($_ eq $/ && $inheaders) { # end of headers
print "$count end of headers at line $.\n" if debug;