From 4e6e53f81be65deb261dad0ab7574acbd27cbc7d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 13 Mar 2023 19:38:26 +0000 Subject: 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. --- lib/PublicInbox/Spamcheck.pm | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/PublicInbox/Spamcheck.pm') 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 +# 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; -- cgit v1.2.3-24-ge0c7