diff options
author | Eric Wong <e@yhbt.net> | 2020-01-23 23:05:56 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-01-24 23:04:53 +0000 |
commit | ff2db829115a5db9cc4d046b4a9018cfba4ca6c0 (patch) | |
tree | bb03edd602b7b14be7b0d86e282872dd70b390e9 /lib/PublicInbox/Inbox.pm | |
parent | ea45e9f71588572a2f4b9299a86cedc3c8e9c72a (diff) | |
download | public-inbox-ff2db829115a5db9cc4d046b4a9018cfba4ca6c0.tar.gz |
And add a note to remind ourselves to use List::Util::uniq when it becomes common.
Diffstat (limited to 'lib/PublicInbox/Inbox.pm')
-rw-r--r-- | lib/PublicInbox/Inbox.pm | 11 |
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; }; |