possible fix to Cache::Memcached (also, large object support q)

Chris Dent cdent at burningchrome.com
Wed Oct 11 19:16:08 UTC 2006


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}).

A patch is attached. Is it correct?

While I'm here: Does the newer stuff in 1.2.0 offer large object
support similar to the kind provided by the patch at:

   http://lists.danga.com/pipermail/memcached/2006-March/002058.html

If so, what's the magic?

Thanks.

-- 
Chris Dent                      http://burningchrome.com/~cdent/mt
                               [...]
-------------- next part --------------
--- 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);


More information about the memcached mailing list