about summary refs log tree commit homepage
path: root/script/public-inbox-learn
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 /script/public-inbox-learn
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 'script/public-inbox-learn')
-rw-r--r--script/public-inbox-learn6
1 files changed, 3 insertions, 3 deletions
diff --git a/script/public-inbox-learn b/script/public-inbox-learn
index 0d6c989b..4c10b68b 100644
--- a/script/public-inbox-learn
+++ b/script/public-inbox-learn
@@ -20,9 +20,9 @@ if ($train !~ /\A(?:ham|spam|rm)\z/) {
 my $spamc = PublicInbox::Spamcheck::Spamc->new;
 my $pi_config = PublicInbox::Config->new;
 my $err;
-my $mime = PublicInbox::MIME->new(eval {
+my $mime = PublicInbox::MIME->new(do{
         local $/;
-        my $data = scalar <STDIN>;
+        my $data = <STDIN>;
         $data =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
 
         if ($train ne 'rm') {
@@ -36,7 +36,7 @@ my $mime = PublicInbox::MIME->new(eval {
                 };
                 $err = $@;
         }
-        $data
+        \$data
 });
 
 sub remove_or_add ($$$$) {