about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-01-23 23:05:56 +0000
committerEric Wong <e@yhbt.net>2020-01-24 23:04:53 +0000
commitff2db829115a5db9cc4d046b4a9018cfba4ca6c0 (patch)
treebb03edd602b7b14be7b0d86e282872dd70b390e9
parentea45e9f71588572a2f4b9299a86cedc3c8e9c72a (diff)
downloadpublic-inbox-ff2db829115a5db9cc4d046b4a9018cfba4ca6c0.tar.gz
And add a note to remind ourselves to use List::Util::uniq
when it becomes common.
-rw-r--r--lib/PublicInbox/Inbox.pm11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index e834d565..07e8b5b7 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -293,12 +293,11 @@ sub nntp_url {
                                 # nntp://news.example.com/alt.example
                                 push @m, $u;
                         }
-                        my %seen = map { $_ => 1 } @urls;
-                        foreach my $u (@m) {
-                                next if $seen{$u};
-                                $seen{$u} = 1;
-                                push @urls, $u;
-                        }
+
+                        # List::Util::uniq requires Perl 5.26+, maybe we
+                        # can use it by 2030 or so
+                        my %seen;
+                        @urls = grep { !$seen{$_}++ } (@urls, @m);
                 }
                 \@urls;
         };