there is error handling in the code; however the symptoms are:
(1) A search completes without error, returning the expected (large amount of) data.
(2) The next searches fails 'Unable to contact LDAP server' (or similar).
The server log shows that the connection was unbound after the successful search in (1) although the code did not issue an 'unbind'.
This in turn explains the unexpected failure in (2) as there is no longer a connection.
I have not yet located a log which shows any error associated with the connection which unexpectedly 'unbound'.
I have so far been unable to reproduce the fault on a test system, and I am reluctant to propose upping the server logging on an extremely heavily loaded live service.
I am now down into the depths of Solaris using ptree and the like, and pretty sure that this is an isssue with the X.500 directory we are using.
Thanks for your help so far; what I have found is that the Mozilla LDAP we are using is not very flexible; there is very little exposed in the 'search' method and the 'API' code seems to break everything.
Investigation from the Perl end does not seem to be a good prospect.
I am now going to throw this at our directory supplier.