[PATCH] avoid Perl warning from MemcachedTest redefining sleep

21 views
Skip to first unread message

Eric Wong

unread,
Feb 16, 2023, 11:40:46 PM2/16/23
to memc...@googlegroups.com
Out of habit, I tend to use `-w' to enable Perl warnings when
running prove, leading to:

Ambiguous call resolved as CORE::sleep(), qualify as such or use & at \
./t/lib/MemcachedTest.pm line 367.

Since Time::HiRes is already used by the test suite, we can just
use the high-resolution sleep from that module rather than
defining our own select-based sleep. sleep has been a part of
Time::HiRes since Time::HiRes was added to the standard library
for before Perl 5.8.0:

https://perl5.git.perl.org/perl5.git/commit/dcf686c9ff9829ff83c8d4e65b735a4ba6a9e6f5
(Integrate Time::Hires 1.20 from Douglas E. Wegscheid., 2001-04-12)
---
t/lib/MemcachedTest.pm | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/t/lib/MemcachedTest.pm b/t/lib/MemcachedTest.pm
index 4b2d409e..0141ec13 100644
--- a/t/lib/MemcachedTest.pm
+++ b/t/lib/MemcachedTest.pm
@@ -5,6 +5,7 @@ use IO::Socket::UNIX;
use POSIX ":sys_wait_h";
use Exporter 'import';
use Carp qw(croak);
+use Time::HiRes qw(sleep);
use vars qw(@EXPORT);

# Instead of doing the substitution with Autoconf, we assume that
@@ -35,11 +36,6 @@ my $server_key = $testdir . SRV_KEY;

my $tls_checked = 0;

-sub sleep {
- my $n = shift;
- select undef, undef, undef, $n;
-}
-
# Wait until all items have flushed
sub wait_ext_flush {
my $sock = shift;
Reply all
Reply to author
Forward
0 new messages