From 7c89df780b7b160fe85b8a355455d06ec8499205 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 24 Jun 2019 02:52:26 +0000 Subject: http|nntp: favor "$! == EFOO" over $!{EFOO} checks Integer comparisions of "$!" are faster than hash lookups. See commit 6fa2b29fcd0477d126ebb7db7f97b334f74bbcbc ("ds: cleanup Errno imports and favor constant comparisons") for benchmarks. --- lib/PublicInbox/HTTPD/Async.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/HTTPD/Async.pm') diff --git a/lib/PublicInbox/HTTPD/Async.pm b/lib/PublicInbox/HTTPD/Async.pm index 3eb7f75a..9cc41f17 100644 --- a/lib/PublicInbox/HTTPD/Async.pm +++ b/lib/PublicInbox/HTTPD/Async.pm @@ -11,6 +11,7 @@ use warnings; use base qw(PublicInbox::DS); use fields qw(cb cleanup); require PublicInbox::EvCleanup; +use Errno qw(EAGAIN); sub new { my ($class, $io, $cb, $cleanup) = @_; @@ -57,7 +58,7 @@ sub main_cb ($$$) { } # fall through to close below... } elsif (!defined $r) { - return restart_read($self) if $!{EAGAIN}; + return restart_read($self) if $! == EAGAIN; } # Done! Error handling will happen in $fh->close -- cgit v1.2.3-24-ge0c7