LemonLDAPNG / Apache-Session-Browseable

Apache::Session::Browseable Perl module
http://search.cpan.org/dist/Apache-Session-Browseable/
Other
3 stars 5 forks source link

Undefined value warning when searching on non existing field with Redis #1

Closed coudot closed 11 years ago

coudot commented 11 years ago

When I use the Redis backend and do a searchOn() method, I have this warning when parsing sessions that do not contain the field searched on:

Use of uninitialized value in string eq at /usr/local/share/perl/5.14.2/Apache/Session/Browseable/Redis.pm line 62, <GEN2> line 12998

Example of code:

#!/usr/bin/perl -w

use strict;
use Apache::Session::Browseable::Redis;
use Time::HiRes qw(gettimeofday);

my $i = shift @ARGV;

my $args = {
    server => '127.0.0.1:6379',
    Index  => 'uid mail',
};

# Creation session
my %session;

tie %session, 'Apache::Session::Browseable::Redis', undef, $args;
$session{uid}            = "me$i";
$session{mail}           = "me$i\@me.com";
$session{test} = "zz$i";
untie %session;

my $start = gettimeofday();
my $hash = Apache::Session::Browseable::Redis->searchOn( $args, 'uid', "me$i" );
my $end  = gettimeofday();
my @sessions = keys %$hash;
my $count = $#sessions;
my $time = ($end - $start) * 1000;

print "Found $count sessions in $time ms (indexed search)\n";

$start = gettimeofday();
$hash = Apache::Session::Browseable::Redis->searchOn( $args, 'test', "zz$i" );
$end  = gettimeofday();
@sessions = keys %$hash;
$count = $#sessions;
$time = ($end - $start) * 1000;

print "Found $count sessions in $time ms (non indexed search)\n";