Subject: | $sub->get dies after second round of message retrieval |
Attached is a script that causes the following error to be thrown:
Not an ARRAY reference at
/usr/lib/perl5/site_perl/5.8.8/IPC/PubSub/Cache.pm line 56.
This happens using DBM::Deep version 1.0009
######### perl -v output
This is perl, v5.8.8 built for x86_64-linux-thread-multi
Subject: | test.pl |
use IPC::PubSub;
# A new message bus with the DBM::Deep backend
# (Other possible backends include Memcached and PlainHash)
# my $bus = IPC::PubSub->new(DBM_Deep => '/tmp/pubsub.db');
my $pid = fork();
if ( ! defined $pid ) {
die "couldn't fork";
}
elsif ( $pid ) {
## Parent
my $bus = IPC::PubSub->new(DBM_Deep => '/tmp/pubsub.db');
# Register a new publisher (you can publish to multiple channels)
#my $pub = $bus->new_publisher("#perl6");
# Register a new subscriber (you can subscribe to multiple channels)
my $sub = $bus->new_subscriber("#perl6");
while(1) {
print "about to check messages\n";
# Simple get: Returns the messages sent since the previous get,
# but only for the first channel.
my @msgs = $sub->get;
foreach my $msg (@msgs) {
print "$msg\n";
}
sleep 5;
}
}
else {
## Child
my $bus = IPC::PubSub->new(DBM_Deep => '/tmp/pubsub.db');
# Register a new publisher (you can publish to multiple channels)
my $pub = $bus->new_publisher("#perl6");
# Register a new subscriber (you can subscribe to multiple channels)
#my $sub = $bus->new_subscriber("#perl6");
while (1) {
# Publish a message (may be a complex object) to those channels
# print "printing message from child";
$pub->msg("This is a message from the child");
sleep 1;
}
}