From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 256FA1F9E5 for ; Mon, 19 Apr 2021 23:49:02 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/4] config: favor ->get_all when possible Date: Mon, 19 Apr 2021 14:48:59 -0900 Message-Id: <20210419234901.4084-3-e@80x24.org> In-Reply-To: <20210419234901.4084-1-e@80x24.org> References: <20210419234901.4084-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It's slightly less code. --- lib/PublicInbox/LeiUp.pm | 5 ++--- lib/PublicInbox/Watch.pm | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/LeiUp.pm b/lib/PublicInbox/LeiUp.pm index 23c5c606..63a7f996 100644 --- a/lib/PublicInbox/LeiUp.pm +++ b/lib/PublicInbox/LeiUp.pm @@ -25,10 +25,9 @@ sub lei_up { $lei->{opt}->{output} = $lss->{-cfg}->{'lei.q.output'} // return $lei->fail("lei.q.output unset in $lss->{-f}"); - my $to_avref = $lss->{-cfg}->can('_array'); for my $k (qw(only include exclude)) { - my $v = $lss->{-cfg}->{"lei.q.$k"} // next; - $lei->{opt}->{$k} = $to_avref->($v); + my $v = $lss->{-cfg}->get_all("lei.q.$k") // next; + $lei->{opt}->{$k} = $v; } for my $k (qw(external local remote import-remote import-before threads)) { diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm index 05956cbb..86dae91f 100644 --- a/lib/PublicInbox/Watch.pm +++ b/lib/PublicInbox/Watch.pm @@ -53,8 +53,7 @@ sub new { # indefinitely... foreach my $pfx (qw(publicinboxwatch publicinboxlearn)) { my $k = "$pfx.watchspam"; - defined(my $dirs = $cfg->{$k}) or next; - $dirs = PublicInbox::Config::_array($dirs); + my $dirs = $cfg->get_all($k) // next; for my $dir (@$dirs) { my $uri; if (is_maildir($dir)) {