http://qs321.pair.com?node_id=269890


in reply to Net::LDAP doesn't return until end of loop

The docs say that the second object passed to the callback for a search will be an entry found:

If the request is a search then multiple packets can be received from the server. Each entry is received as a separate packet. For each of these the subroutine will be called with a Net::LDAP::Entry object as the second argument.

So I think the callback should look like this:

sub callback { my ($searchobj, $entry) = @_; # note: no 'shift' if ($entry) { print $entry->dn, "\n"; print $entry->get_value('plan'); print $entry->get_value('ipaddress'); print $entry->get_value('username'); } else { warn "No entry passed in for callback...\n"; } }

This will at least let you know that your callback is being called the appropriate number of times.

Chris
M-x auto-bs-mode