brancusi has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks I use Memcached in conjunction with ubuntu and Windows server 2003 hosts without problems, but I'm now trying to write some code that needs to run under windows XP and the client library seems to be unhappy under XP. My environment is Activestate Perl 5.10.0 and Cache::Memcached installed via PPM. My minimal test case is;
use strict; use warnings; use Data::Dumper; use Cache::Memcached; my $CACHE = new Cache::Memcached( { servers => [ "myremotecache.com:11 +211" ] }); print Dumper($CACHE->stats());
This works fine from a remote linux box (the cache is on a different windows 2003 server) and on the windows XP machine I can telnet to the remote cache OK and issue a stats command manually. The code above however fails with Use of initialized value $sock in ref-to-glob cast at ... Memcached.pm line 365 and a clutch of other similar errors. Does any learned Monk know how whether or not the client library should work under XP and if not, how it might be fixed?

Replies are listed 'Best First'.
Re: Perl Memcached client under Windows XP
by Anonymous Monk on May 25, 2010 at 08:17 UTC
    Turn on debugging
    ->new( 'debug' => 1, ...

      Turn on debugging

      Did that, no change, same output as before.
Re: Perl Memcached client under Windows XP
by BrowserUk (Patriarch) on May 25, 2010 at 22:55 UTC

    You might do well to identify which version of C::MC you have, and/or post the line identified as having the error.

    The latest version, #365 is my ($ret, $offset) = (undef, 0); which couldn't possible produce that error.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      It's Version 1.26

      Here's the entire output. I don't think the line numbers are that helpful though, I'm pretty sure the problem is to do with socket(...) not actually opening/creating the socket, but as it doesn't seem to return any error codes and I'm not sure what it is doing under the hood, I'm a bit lost as to where to go next for a fix.

      I note that the Activestate examples are using IO::Socket rather than socket() directly and I further note that IO::Socket contains specifics for Win32, so that's where I'm inclined to think the problem lies.

      Use of uninitialized value $sock in ref-to-glob cast at C:/Perl/site/l +ib/Cache/Memcached.pm line 368. Use of uninitialized value in vec at C:/Perl/site/lib/Cache/Memcached. +pm line 368. Use of uninitialized value $sock in ref-to-glob cast at C:/Perl/site/l +ib/Cache/Memcached.pm line 375. Use of uninitialized value in vec at C:/Perl/site/lib/Cache/Memcached. +pm line 375. Use of uninitialized value $sock in ref-to-glob cast at C:/Perl/site/l +ib/Cache/Memcached.pm line 376. send() on unopened socket at C:/Perl/site/lib/Cache/Memcached.pm line +376. Use of uninitialized value $res in numeric gt (>) at C:/Perl/site/lib/ +Cache/Memcached.pm line 379. Use of uninitialized value $sock in hash element at C:/Perl/site/lib/C +ache/Memcached.pm line 181. Use of uninitialized value $sock in hash element at C:/Perl/site/lib/C +ache/Memcached.pm line 168.

        Sorry. I still can't make the error messages match up with the code. It looks for all the world like it is simply failing to connect to the server, but why that should be I haven't a clue. It also uses non-blocking sockets, but makes no provision to handle Windows special requirements in that regard, which doesn't bode well.

        A quick look around found this MemCached-Windows. There seems to be a lot of further info and special Windows ports of the code...maybe you can make progress there.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Perl Memcached client under Windows XP
by sagargupta (Initiate) on Oct 24, 2012 at 17:26 UTC
    Follow this article that I have written. This should work fine for Win7 and WinXP. It helps in setting up the Memcached Server and Perl Client. http://drunktech.blogspot.com/2012/10/setting-up-memcached-client-and-server.html