Subject: | One extra callback to subroutine in search method. |
Date: | Wed, 3 Feb 2010 15:01:20 +0300 |
To: | bug-perl-ldap [...] rt.cpan.org |
From: | Lior Goikhburg <lgoikhburg [...] griddynamics.com> |
When a callback subroutine is specified for the search method, it's called
one extra time, after the last valid entry. It returns UNDEF for entry
object and Success as result in this extra call.
Can't find this behavior documented anywhere so assuming it's a bug.
This happens in:
Tested on:
Linux 2.6.31
Net::LDAP 0.39
perl5 (revision 5 version 10 subversion 0)
and also
Linux 2.6.18
Net::LDAP 0.34
perl5 (revision 5 version 10 subversion 0)
OpenLDAP: slapd 2.4.19
Code:
#!/usr/bin/perl
use strict;
use Net::LDAP;
my $ldap = Net::LDAP->new( 'ldap.server.company.com' ) or die "$@";
my $result = $ldap->bind ( "cn=user,dc=company,dc=com",
password => "password",
version => 3 );
$result = $ldap->search( base => "ou=container,dc=company,dc=com",
filter => "(uid=*)",
callback => \&process_entry
);
$result = $ldap->unbind;
sub process_entry {
print "called\n";
}
called is printed one extra time
--
Regards,
Lior Goikhburg