Subject: | __read_multi_bulk should probably return an array reference |
Date: | Fri, 12 Mar 2010 13:06:01 -0700 |
To: | bug-Redis [...] rt.cpan.org |
From: | Will Conant <will.conant [...] gmail.com> |
It is currently awkward to distinguish an empty array result from a null
result. Right now, I do this:
my @result = $redis->lrange("foo", 0, 5);
if (scalar(@result) == 1 && !defined($result[0])) {
# The key was missing. Empty the array before using it.
@result = ();
}
foreach my $item (@result) { ... }
If, instead, multi-bulk commands returned undef or an array reference, I
could do this:
foreach my $item (@{ $redis->lrange("foo", 0, 5) || [] }) { ... }
Thank you!
--
Will Conant