The &RedisDB::_connect method will place the connection in pipelined mode when specifying a password, database or connection name in the constructor. This is incompatible if you want to use &subscription_loop, the user either has to call &mainloop before calling the subscription loop, or some special coordination should be done inside subscription_loop so it can call mainloop if it's detected that it's just connected and no other commands have been run.
use strict; use warnings; use 5.010;
use RedisDB;
my $redis = RedisDB->new(database => 1);
# uncomment for this to work
# $redis->mainloop;
$redis->subscription_loop(subscribe => [foo => sub { shift->unsubscribe }]);
You can't start subscription loop while in pipelining mode. at redis.pl line 7
The
&RedisDB::_connect
method will place the connection in pipelined mode when specifying a password, database or connection name in the constructor. This is incompatible if you want to use&subscription_loop
, the user either has to call&mainloop
before calling the subscription loop, or some special coordination should be done inside subscription_loop so it can call mainloop if it's detected that it's just connected and no other commands have been run.