From 2d3699d2ce8cbee21485c8b31b1f681d2bb5def5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 13 Nov 2023 13:15:41 +0000 Subject: treewide: update read_all to avoid eof|close checks read_all can be expanded to support FIFOs/pipes/sockets where read-until-EOF behavior is desired. We can also rely on wantarray to support splitting on EOL markers, but it's hard-coded to support only `$/ eq "\n"' since (AFAIK) it's the only way we use the wantarray form `readline'. --- lib/PublicInbox/LeiToMail.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/PublicInbox/LeiToMail.pm') diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index 0d2f586a..2928be45 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -687,8 +687,7 @@ sub _pre_augment_v2 { my $d = "$lei->{ale}->{git}->{git_dir}/objects"; open my $fh, '+>>', my $f = "$dir/git/0.git/objects/info/alternates"; seek($fh, 0, SEEK_SET); # Perl did SEEK_END when it saw '>>' - my $seen = grep(/\A\Q$d\E\n/, <$fh>); - eof($fh) or die "not at `$f' EOF ($!)"; # $! was set by readline + my $seen = grep /\A\Q$d\E\n/, PublicInbox::IO::read_all $fh; print $fh "$d\n" if !$seen; close $fh; } -- cgit v1.2.3-24-ge0c7