]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
spamcheck: use v5.12 and golf
authorEric Wong <e@80x24.org>
Mon, 13 Mar 2023 19:38:26 +0000 (19:38 +0000)
committerEric Wong <e@80x24.org>
Tue, 14 Mar 2023 20:51:01 +0000 (20:51 +0000)
No problems with `unicode_strings' in these modules.  We can
also shave our LoC count in a few places.

lib/PublicInbox/Spamcheck.pm
lib/PublicInbox/Spamcheck/Spamc.pm

index d8fa80c84fdd8873e8b9c8f617773f99e199238f..fbf9355d08d0071e10525e49cf298ac67a48c450 100644 (file)
@@ -1,21 +1,17 @@
-# Copyright (C) 2018-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Spamchecking used by -watch and -mda tools
 package PublicInbox::Spamcheck;
-use strict;
-use warnings;
+use v5.12;
 
 sub get {
        my ($cfg, $key, $default) = @_;
-       my $spamcheck = $cfg->{$key};
-       $spamcheck = $default unless $spamcheck;
+       my $spamcheck = $cfg->{$key} || $default;
 
        return if !$spamcheck || $spamcheck eq 'none';
 
-       if ($spamcheck eq 'spamc') {
-               $spamcheck = 'PublicInbox::Spamcheck::Spamc';
-       }
+       $spamcheck = 'PublicInbox::Spamcheck::Spamc' if $spamcheck eq 'spamc';
        if ($spamcheck =~ /::/) {
                eval "require $spamcheck";
                return $spamcheck->new;
index d2b6429c46e44e8f660c354458ef5cd0fa885603..2f82153249c3555b08a7c6f1953ccbe97414b019 100644 (file)
@@ -1,10 +1,9 @@
-# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Default spam filter class for wrapping spamc(1)
 package PublicInbox::Spamcheck::Spamc;
-use strict;
-use warnings;
+use v5.12;
 use PublicInbox::Spawn qw(popen_rd spawn);
 use IO::Handle;
 use Fcntl qw(SEEK_SET);