diff options
author | Eric Wong <e@80x24.org> | 2023-06-09 10:31:08 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-06-09 18:58:29 +0000 |
commit | dd986388c89a46417c7513478adcf1da1d4b92ae (patch) | |
tree | b6b8c3d1bdefdbde339d0838099e123a997fa92c /lib/PublicInbox/Inbox.pm | |
parent | 56cdc78884fdc7378c727d9aa8861acbc56940f9 (diff) | |
download | public-inbox-dd986388c89a46417c7513478adcf1da1d4b92ae.tar.gz |
This will make it easier to switch in the far future while making callers easier-to-read (and more callers will be added). Anyways, Perl 5.26 is a long time away for enterprise users; but isolating compatibility code away can improve readability of code we actually care about in the meantime.
Diffstat (limited to 'lib/PublicInbox/Inbox.pm')
-rw-r--r-- | lib/PublicInbox/Inbox.pm | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index cb98d2ad..9afbb478 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -10,6 +10,7 @@ use PublicInbox::MID qw(mid2path); use PublicInbox::Eml; use List::Util qw(max); use Carp qw(croak); +use PublicInbox::Compat qw(uniqstr); # returns true if further checking is required sub check_inodes ($) { @@ -250,11 +251,7 @@ EOM # nntp://news.example.com/alt.example push @m, $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 = uniqstr @urls, @m; } \@urls; } @@ -274,8 +271,7 @@ sub pop3_url { @urls = map { m!\Apop3?s?://! ? $_ : "pop3://$_" } @$ps; if (my $mi = $self->{'pop3mirror'}) { my @m = map { m!\Apop3?s?://! ? $_ : "pop3://$_" } @$mi; - my %seen; # List::Util::uniq requires Perl 5.26+ - @urls = grep { !$seen{$_}++ } (@urls, @m); + @urls = uniqstr @urls, @m; } my $n = 0; for (@urls) { $n += s!/+\z!! } |