The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

main - Perl redis shell

VERSION

version 0.1

SYNOPSIS

 $ redisp
 localhost> keys "foo*"
 "foobar", "food"
 localhost> set foobarbaz 12
 "OK"

 # Or in perl style
 localhost> $foobar
 10

 localhost> .encoding utf-8
 localhost> .server xxx
 localhost> .reconnect
 localhost> .output json

DESCRIPTION

Redis and Perl share similar data types, therefore I thought it would be useful to have a Redis shell interface that appears to behave as Perl. This is a Perl Read-Eval-Print Loop (REPL) that happens to understand Redis.

The use of Redis aims to be transparent, you just use a variable like $foo and it will be read or saved to Redis. For a temporary variable that is only visible to Perl use my $foo.

USAGE

 redisp [--help] [--server=host] [--port=port] [--encoding=encoding]
   [--serialize=serializer]

OPTIONS

  • --help

    This document.

  • --server

    Host to connect to Redis on.

  • --port

    Port to connect to Redis on.

  • --encoding

    Encoding to use with Redis, UTF-8 is recommended (but the default is none).

  • --serialize

    Serializer to use, see the Tie::Redis documentation for details on supported serializers and the limitations.

LIMITATIONS

The main noticable thing is common key naming styles in Redis such as "foo-bar" or "foo:bar" require quoting on the Perl side. For example to access a top level key of foo:bar you need to access ${"foo:bar"}.

In Redis a key has one type; in Perl a glob reference may have HASH, ARRAY, SCALAR, etc values. This application makes Perl match the Redis behaviour, it's invalid to use more than one type at a particular name. The error will be: ERR Operation against a key holding the wrong kind of value.

BUGS

This goes quite close to the internals of Perl so there may be issues with constructs I haven't thought of. Raise bugs via http://rt.cpan.org.

The output produced by:

  ANYEVENT_REDIS_DEBUG=1 DEBUG=1 redisp

for your issue would be helpful.

SEE ALSO

Tie::Redis, http://redis.io/commands, Eval::WithLexicals, Term::ReadLine::Perl (I recommend you install this or ::Gnu).

AUTHOR

David Leadbeater <dgl@dgl.cx>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by David Leadbeater.

This is free software; you can redistribute it and/or modify it under the terms of the Beerware license.