View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
David Leadbeater > App-redisp-0.13 > App::redisp



Annotate this POD

View/Report Bugs
Module Version: 0.13   Source  


App::redisp - Perl redis shell


version 0.13


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

 # Or in perl style
 localhost> $foobar

 # Actually these next ones aren't implemented yet...
 localhost> .encoding utf-8
 localhost> .server xxx
 localhost> .reconnect
 localhost> .output json


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.


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



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.

Due to the way this works it's impossible to use symbolic references (e.g. ${"foo$a"}), your code needs to reference top level keys it uses at compile time.


Yet more examples, because the synopsis section was getting sort of big.

info is a command that returns a hash, so to grab something like the version you can do this:

 localhost> info
 [returns big hash]

 localhost> info->{redis_version}

Due to some commands clashing with Perl keywords you can't use them as functions. Keys and exists is something notable for this.

  localhost> keys "foo*" # Special cased

  localhost> sort keys "foo*" # doesn't work as you'd expect

  localhost> sort redis qw(keys foo*) # does what you wanted

Pub/sub can be used, but you need to write some code yourself: XXX: This doesn't work at all yet!

 localhost> subscribe foo, sub { print "@_\n" }
 [prints messages, ^C stops, but you'll need to unsubscribe manually]
 localhost> unsubscribe foo


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

The output produced by:


for your issue would be helpful.


Tie::Redis,, Eval::WithLexicals, Term::ReadLine::Perl (I recommend you install this or ::Gnu).


David Leadbeater <>


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

This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Beer-ware license revision 42.

syntax highlighting: