Subject: | Warning produced when flush_all called |
When calling flush_all() with Cache::Memcached 1.18, a warning happens:
Use of uninitialized value in send at
/usr/local/share/perl/5.8.7/Cache/Memcached.pm line 339
This appears to be because flush_all() calls run_command(), which then
calls _write_and_read() _twice_ instead of once. The 'last' in
run_command() doesn't trigger because flush_all returns OK, not END or
ERROR (at least that's the case in 1.1.1{2,3}).
See also: http://lists.danga.com/pipermail/memcached/2006-October/002857.html
Here's a patch:
--- lib/Cache/Memcached.pm 2006-06-27 22:59:59.000000000 -0700
+++ /usr/local/share/perl/5.8.7/Cache/Memcached.pm 2006-10-11 11:58:15.000000000
-0700
@@ -804,7 +804,7 @@
while (my $res = _write_and_read($self, $sock, $line)) {
undef $line;
$ret .= $res;
- last if $ret =~ /(?:END|ERROR)\r\n$/;
+ last if $ret =~ /(?:OK|END|ERROR)\r\n$/;
}
chop $ret; chop $ret;
return map { "$_\r\n" } split(/\r\n/, $ret);