diff options
author | Eric Wong <e@80x24.org> | 2023-03-13 19:38:26 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-03-14 20:51:01 +0000 |
commit | 4e6e53f81be65deb261dad0ab7574acbd27cbc7d (patch) | |
tree | 1914622d3c0f70c210af3b35afdba6f02b169712 | |
parent | 3a2c46e6f7bf650e69cf7c7b9e3d62843e6deab9 (diff) | |
download | public-inbox-4e6e53f81be65deb261dad0ab7574acbd27cbc7d.tar.gz |
No problems with `unicode_strings' in these modules. We can also shave our LoC count in a few places.
-rw-r--r-- | lib/PublicInbox/Spamcheck.pm | 12 | ||||
-rw-r--r-- | lib/PublicInbox/Spamcheck/Spamc.pm | 5 |
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/PublicInbox/Spamcheck.pm b/lib/PublicInbox/Spamcheck.pm index d8fa80c8..fbf9355d 100644 --- a/lib/PublicInbox/Spamcheck.pm +++ b/lib/PublicInbox/Spamcheck.pm @@ -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; diff --git a/lib/PublicInbox/Spamcheck/Spamc.pm b/lib/PublicInbox/Spamcheck/Spamc.pm index d2b6429c..2f821532 100644 --- a/lib/PublicInbox/Spamcheck/Spamc.pm +++ b/lib/PublicInbox/Spamcheck/Spamc.pm @@ -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); |