OpenInteract::LDAP - Centralized connection location to LDAP directories


 # Get a connection to the LDAP directory using the 'main' parameters
 # from your server configuration

 my $ldap = eval { OpenInteract::LDAP->connect( $CONFIG->{ldap_info}{main} ) };
 if ( $@ ) {
    die "Cannot connect to directory: $@";

 # Bind the connection using the same parameters

 eval { OpenInteract::LDAP->bind( $ldap, $CONFIG->{ldap_info}{main} ) };
 if ( $@ ) {
    die "Cannot bind to directory: $@";

 # Do both at once with the same information
 my $ldap = eval { OpenInteract::LDAP->connect_and_bind(
                                             $CONFIG->{ldap_info}{main} ) };
 if ( $@ ) {
    die "LDAP connect/bind error: $@";


Connect and/or bind to an LDAP directory.


connect( \%connect_params, \%other_params )

Parameters used:

  • host: host LDAP server is running on

  • port: defaults to 389

  • debug: see Net::LDAP for what this will do

  • timeout: defaults to 120

  • version: defaults to 2; version of the LDAP protocol to use.

Returns: valid Net::LDAP connection handle, or issues a die explaining why it failed.

bind( $ldap_connection, \%bind_params )

Bind an LDAP connection using a DN/password combination. With many servers, you can do this more than once with a single connection.

Parameters used:

  • bind_dn: DN to bind as.

  • bind_password: Password to use when binding.

  • sasl: If set to true, use SASL for authentication. Note: this is completely untested, and even if it works it only uses the CRAM-MD5 method of authentication.

Returns: LDAP handle with bind() run, or calls die to explain why it failed.

connect_and_bind( \%connect_params, \%other_params )

Run both the connect() and bind() methods.


None known.


Nothing known.




Copyright (c) 2001-2002 MSN Marketing Service Nordwest, GmbH. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Chris Winters <>