On 6 Feb 2008, at 22:05, Michael Alan Dorman wrote:
On a host that has an LDAP server running, try:
perl -MNet::LDAP -e 'my $ldap = Net::LDAP->new ('localhost'); $ldap-
>sync'
You'll get a failure like:
Can't use an undefined value as a HASH reference
at /usr/share/perl5/Net/LDAP.pm line 742, <DATA> line 228.
I've attached a patch that guards against this situation arising; it
would be nice if it could be included in a future version of the
module.
Thanks for developing Net::LDAP!
Mike.<net-ldap.patch>
I simplified it slightly, and revision 542 contains this change:
Index: LDAP.pm
===================================================================
--- LDAP.pm (revision 541)
+++ LDAP.pm (working copy)
@@ -28,7 +28,7 @@
LDAP_UNAVAILABLE
);
-$VERSION = "0.34_02";
+$VERSION = "0.34_03";
@ISA = qw(Tie::StdHash Net::LDAP::Extra);
$LDAP_VERSION = 3; # default LDAP protocol version
@@ -746,6 +746,8 @@
my $table = $ldap->{net_ldap_mesg};
my $err = LDAP_SUCCESS;
+ return $err unless defined $table;
+
$mid = $mid->mesg_id if ref($mid);
while (defined($mid) ? exists $table->{$mid} : %$table) {
last if $err = $ldap->process($mid);
Can you check that still fixes your problem?
Cheers,
Chris