From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/3] spamcheck: use v5.12 and golf
Date: Mon, 13 Mar 2023 19:38:26 +0000 [thread overview]
Message-ID: <20230313193827.3635690-3-e@80x24.org> (raw)
In-Reply-To: <20230313193827.3635690-1-e@80x24.org>
No problems with `unicode_strings' in these modules. We can
also shave our LoC count in a few places.
---
lib/PublicInbox/Spamcheck.pm | 12 ++++--------
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);
next prev parent reply other threads:[~2023-03-13 19:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 19:38 [PATCH 0/3] watch-related IMAP/NNTP tweaks Eric Wong
2023-03-13 19:38 ` [PATCH 1/3] use v5.12 for various network client-side packages Eric Wong
2023-03-13 19:38 ` Eric Wong [this message]
2023-03-13 19:38 ` [PATCH 3/3] watch: add space before "UID" or "ARTICLE" in warnings Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230313193827.3635690-3-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).