about summary refs log tree commit homepage
path: root/scripts/import_maildir
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-18 03:38:50 +0000
committerEric Wong <e@yhbt.net>2020-04-19 08:51:24 +0000
commita479b45117ed69d9311770fa39e6676d38f9cab2 (patch)
tree9262dbdd0147b02a7d9d9a797271ec25e8aa1c5f /scripts/import_maildir
parenta014723b600e35cd495f048c89611e611436a15e (diff)
downloadpublic-inbox-a479b45117ed69d9311770fa39e6676d38f9cab2.tar.gz
I did not know to use the return value of `do' back in the day.
There's probably no practical difference in these cases, but
`eval' is overkill for these uses and may hide actual errors.

We can get rid of a few redundant `scalar' ops and pass scalar
refs to Email::MIME->new to avoid copies in a few more places,
too.
Diffstat (limited to 'scripts/import_maildir')
-rwxr-xr-xscripts/import_maildir4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/import_maildir b/scripts/import_maildir
index fbf3f649..f4e82543 100755
--- a/scripts/import_maildir
+++ b/scripts/import_maildir
@@ -28,7 +28,7 @@ my @msgs;
 foreach my $sub (qw(cur new)) {
         foreach my $fn (glob("$dir/$sub/*")) {
                 open my $fh, '<', $fn or next;
-                my $s = Email::Simple->new(eval { local $/; <$fh> });
+                my $s = Email::Simple->new(do { local $/; <$fh> });
                 my $date = $s->header('Date');
                 my $t = eval { str2time($date) };
                 defined $t or next;
@@ -45,7 +45,7 @@ my $im = PublicInbox::Import->new($git, $name, $email);
 while (my $ary = pop @msgs) {
         my $fn = "$dir/$ary->[1]";
         open my $fh, '<', $fn or next;
-        my $mime = PublicInbox::MIME->new(eval { local $/; <$fh> });
+        my $mime = PublicInbox::MIME->new(do { local $/; <$fh> });
         $im->add($mime);
 }
 $im->done;