Perl Cache::Memcached not connecting

Cahill, Earl ecahill at
Thu Nov 9 06:57:36 UTC 2006

I think you just need to make servers an array ref, like so

my $mcd = new Cache::Memcached {'servers' => [""]};

I think that's kind of a bug, but maybe not.  I think it should at least
die on the instantiation with something like 'servers needs to be an
array ref', but I would say, heck, just change it to an array ref on the

Seems like something like

$self->{'servers'} = [$self->{'servers'}]
unless(UNIVERSAL::isa($self->{'servers'}, 'ARRAY'));

Right after 

    $self->{'servers'} = $list || [];

In set_servers would do the trick.

I have made your same mistake in the past.



-----Original Message-----
From: memcached-bounces at
[mailto:memcached-bounces at] On Behalf Of Adam Dixon
Sent: Wednesday, November 08, 2006 11:42 PM
To: memcached at
Subject: Perl Cache::Memcached not connecting

First time playing about with memcached, seems pretty straight
forward, start it up, and start 'set'ing objects into the cache; My
example perl script however doesnt work, I cannot seem to get it to
actually connect (when starting memcached with -vv).
Ive tried this on 3 systems 2 CentOS4 perl 5.8.5 and a FreeBSD 6.1
with perl 5.8.8 both seem to be acting the same.
I installed libevent and memcached from the source downloads and
Cache::Memcached from CPAN

memcache source files 'make test' looks ok to me, 2 subtests skipped
but that seems normal from my googling.
use Cache::Memcached;
use Data::Dumper;
use strict;

my ($obj, $username);
my $mcd = new Cache::Memcached {'servers' => ""};

print $mcd->set("my_key", "Some value");

This always prints 0, as in, not actually set properly. I dont get any
output when memcached is running under -vv (apart from when it starts

Anyone know what I can try to get this going properly?


More information about the memcached mailing list