Subject: | Cache::Memcached using sockets bug |
Date: | Sat, 13 Mar 2010 14:51:30 +0200 |
To: | bug-Cache-Memcached [...] rt.cpan.org |
From: | MaxiM Basunov <maxim.basunov [...] gmail.com> |
Hello
While trying to configure Cache::Memcached
our $cache_server = { servers => [ "/var/run/exim/memcached2.socket"] };
to use socket of memcached, it gives error at string "$ip =~", because of
socket path does not contain ":" and variables is uninitialized...
So, we made workaround of this bug adding ":0" to socket path.
To resolve of this bug, all IP code should be moved inside IF into IP
section.
sub sock_to_host { # (host)
my Cache::Memcached $self = ref $_[0] ? shift : undef;
my $host = $_[0];
return $cache_sock{$host} if $cache_sock{$host};
my $now = time();
my ($ip, $port) = $host =~ /(.*):(\d+)$/;
$ip =~ s/[\[\]]//g; # get rid of optional IPv6 brackets
return undef if
$host_dead{$host} && $host_dead{$host} > $now;
my $sock;
my $connected = 0;
my $sin;
my $proto = $PROTO_TCP ||= getprotobyname('tcp');
if ( index($host, '/') != 0 )
{
[root@ init.d]# perl -v; uname -a; head -1 Memcached.pm
This is perl, v5.8.8 built for x86_64-linux-thread-multi
Linux 2.6.18-164.6.1.el5 #1 SMP Tue Nov 3 16:12:36 EST 2009 x86_64 x86_64
x86_64 GNU/Linux
# $Id: Memcached.pm 833 2009-10-21 21:51:10Z bradfitz $
--
WBR, MaxiM Basunov