]> Sergey Matveev's repositories - public-inbox.git/commitdiff
config: favor ->get_all when possible
authorEric Wong <e@80x24.org>
Mon, 19 Apr 2021 23:48:59 +0000 (14:48 -0900)
committerEric Wong <e@80x24.org>
Tue, 20 Apr 2021 19:02:45 +0000 (19:02 +0000)
It's slightly less code.

lib/PublicInbox/LeiUp.pm
lib/PublicInbox/Watch.pm

index 23c5c606502d4a5c53499296ce4722cea65c553c..63a7f996174f1cb96b3d3618adf537ee6dcb0f01 100644 (file)
@@ -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)) {
index 05956cbb48486e60faa3d17740c2e5cf7ee17434..86dae91fd65149849966f3b6e7c968be3930289e 100644 (file)
@@ -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)) {