From 7bca96023bb26438a5c9d0a7eec3986f5d66f5bf Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 17 May 2020 19:48:14 +0000 Subject: favor readline() and print() as functions In our inbox-writing code paths, ->getline as an OO method may be confused with the various definitions of `getline' used by the PSGI interface. It's also easier to do: "perldoc -f readline" than to figure out which class "->getline" belongs to (IO::Handle) and lookup documentation for that. ->print is less confusing than the "readline" vs "getline" mismatch, but we can still make it clear we're using a real file handle and not a mock interface. Finally, functions are a bit faster than their OO counterparts. --- lib/PublicInbox/V2Writable.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/V2Writable.pm') diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index c732b98a..513e9f23 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -606,7 +606,7 @@ sub barrier_wait { my $bnote = $self->{bnote} or return; my $r = $bnote->[0]; while (scalar keys %$barrier) { - defined(my $l = $r->getline) or die "EOF on barrier_wait: $!"; + defined(my $l = readline($r)) or die "EOF on barrier_wait: $!"; $l =~ /\Abarrier (\d+)/ or die "bad line on barrier_wait: $l"; delete $barrier->{$1} or die "bad shard[$1] on barrier wait"; } -- cgit v1.2.3-24-ge0c7