From dd986388c89a46417c7513478adcf1da1d4b92ae Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 9 Jun 2023 10:31:08 +0000 Subject: add compat package for List::Util::uniqstr 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. --- lib/PublicInbox/LeiImport.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/LeiImport.pm') diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm index 9053048a..a324a652 100644 --- a/lib/PublicInbox/LeiImport.pm +++ b/lib/PublicInbox/LeiImport.pm @@ -7,6 +7,7 @@ use strict; use v5.10.1; use parent qw(PublicInbox::IPC PublicInbox::LeiInput); use PublicInbox::InboxWritable qw(eml_from_path); +use PublicInbox::Compat qw(uniqstr); # /^input_/ subs are used by (or override) PublicInbox::LeiInput superclass @@ -40,8 +41,7 @@ sub pmdir_cb { # called via wq_io_do from LeiPmdir->each_mdir_fn my @oidbin = $lms ? $lms->name_oidbin($folder, $bn) : (); @oidbin > 1 and warn("W: $folder/*/$$bn not unique:\n", map { "\t".unpack('H*', $_)."\n" } @oidbin); - my %seen; - my @docids = sort { $a <=> $b } grep { !$seen{$_}++ } + my @docids = sort { $a <=> $b } uniqstr map { $lse->over->oidbin_exists($_) } @oidbin; my $vmd = $self->{-import_kw} ? { kw => $kw } : undef; if (scalar @docids) { -- cgit v1.2.3-24-ge0c7