]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-learn
favor `do {}' over `eval {}' for localized slurp
[public-inbox.git] / script / public-inbox-learn
index 93aece2e66b6c0d0fecf1d718070e5e213099f7a..4c10b68b994506bd4949e197028bd7caa2d8a7f1 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org>
+# Copyright (C) 2014-2020 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # Used for training spam (via SpamAssassin) and removing messages from a
@@ -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 ($$$$) {