Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Perl, Memcached and SASL

by moritz (Cardinal)
on Jun 19, 2013 at 20:03 UTC ( #1039838=perlquestion: print w/replies, xml ) Need Help??
moritz has asked for the wisdom of the Perl Monks concerning the following question:

I need to talk to a memcached server in Perl program, and I need to uses SASL.

Now Perl has a whole bunch of memcached client libraries, but seems that none supports SASL.

The closest seems to be Memcached::libmemcached, which is a very thin wrapper around the C libmemcached library. In theory, all I need to do is to expose the memcached_set_sasl_auth_data function, call it once, and be happy. In practice, this segfaults (I've tried this in the sasl branch of this repository). It seems that the libmemcached library bundled with the perl module is very out of date, and upgrading to a new one is no easy task, because much of structure of the header files changed.

My next hope was that it could be relatively easy to pair up Authen::SASL and one of the existing memcached clients. However Memcached only supports SASL for the binary protocol, and all the other perl modules only support the text protocol (please correct me if I'm wrong here).

Finally there's a small pure-perl client in the tests of the memcached server, which seems to be my only remaining option. I'm reluctant to use it though, because it's not maintained as a "real" client, has no docs and no proper error handling.

So, my question is: Are there any options I overlooked? Or is somebody maybe even working on a client with sasl support? (Or is there another comparable open-source distributed memory cache with perl libraries that support authentication?).

Replies are listed 'Best First'.
Re: Perl, Memcached and SASL
by Loops (Curate) on Jun 20, 2013 at 01:24 UTC

    This one supports the binary protocol:


    But no native SASL support. If you manage to wire something up it'd be great to hear about your success.

Re: Perl, Memcached and SASL
by strredwolf (Chaplain) on Jun 19, 2013 at 23:02 UTC

    Is this Memcache on a remote server or on the server you will have your Perl on?

    Information doesn't want to be free. It wants to be feline.

      Yes. I will have it installed on same four machines that the application runs on, and I have some freedom of how the stuff is set up, exactly. But since people can ssh to those machines, authentication is mandatory.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1039838]
Approved by jfroebe
Front-paged by Corion
[marinersk]: sub newtest{my $expected_result = &target('foo'); my $actual_result = &target('foo'); if ($actual_result eq $expected_result) { &tdd_success(); } else { &tdd_fail(); } } # Test works after three years!
[choroba]: or nobody bothered...
[choroba]: The problem was bigger, as the test tried to call a method that didn't exist anymore
[marinersk]: :: ducking ::
[choroba]: because, someone renamed the method, but didn't notice it was used in the test, as the test was skipped
[marinersk]: Well, if the method doesn't exist, it would be hard to pass the test.
[choroba]: later, someone removed the new method, as all its usage places were safe, but didn't notice the test still used the old name
[choroba]: fortunately, it wasn't that hard to replace the method and fix a few remaining failures due to the changes we did to the codebase over the years
[marinersk]: choroba Sounds like a process improvement opportunity; tests may not all need to be run, but they should all be compiled with perl -c before check-in/promotion happens.
[choroba]: so, now I have the test, so I can start making changes in the code. Back to the original ticket, yay!

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (14)
As of 2017-05-25 15:10 GMT
Find Nodes?
    Voting Booth?