On Tue, September 20, 2005 1:02 am, Chris Ridd wrote: > On 20/9/05 5:02, Christopher A Bongaarts <[EMAIL PROTECTED]> wrote: > >> In the immortal words of Dolan, Sean (N-ISYS Technologies Inc.): >>> I know that Net::LDAP can support multiple hosts. >>> >>> [from documentation] >>> "HOST may also be a reference to an array of hosts, host-port pairs >>> or URIs to try. Each will be tried in order until a connection is made. >>> Only when all have failed will the result of undef be returned >>> >>> When a bind is done, how can we tell which server it connected to? >>> It'd be nice for logging purposes in our scripts. >>> >>> Any ideas? >> >> Quick 'n' dirty, but bad OOP practice and may break in future >> versions: you can get at the IO::Socket object after new() using >> $ldap->{net_ldap_socket}, then use IO::Socket's methods to get >> PeerHost/PeerAddr. > > Actually you can just call $ldap->socket() to get the IO::Socket object > being used. This is a documented method, so is safe.
Right. But what Sean really wants is prtobably just what is stored in $ldap->{net_ldap_host}. We should add a ->host method to return that. A ->uri method to return ->{net_ldap_uri} may be useful too. Graham.