From: Eric Wong Date: Mon, 13 Mar 2023 19:38:26 +0000 (+0000) Subject: spamcheck: use v5.12 and golf X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e6e53f81be65deb261dad0ab7574acbd27cbc7d;p=thirdparty%2Fpublic-inbox.git spamcheck: use v5.12 and golf No problems with `unicode_strings' in these modules. We can also shave our LoC count in a few places. --- diff --git a/lib/PublicInbox/Spamcheck.pm b/lib/PublicInbox/Spamcheck.pm index d8fa80c84..fbf9355d0 100644 --- a/lib/PublicInbox/Spamcheck.pm +++ b/lib/PublicInbox/Spamcheck.pm @@ -1,21 +1,17 @@ -# Copyright (C) 2018-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # 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; diff --git a/lib/PublicInbox/Spamcheck/Spamc.pm b/lib/PublicInbox/Spamcheck/Spamc.pm index d2b6429c4..2f8215324 100644 --- a/lib/PublicInbox/Spamcheck/Spamc.pm +++ b/lib/PublicInbox/Spamcheck/Spamc.pm @@ -1,10 +1,9 @@ -# Copyright (C) 2016-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # 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);