LDAPInfo
- Class to retrieve LDAP information from an LDAP-server.
use LDAPInfo;
# instantiate
my $ldap=LDAPInfo->new(server=>"localhost",dn=>"username",password=>"MYPW",confidential=>1);
# bind
$ldap->bind();
# search
my $result=$ldap->search(base=>"ou=MYOU,dc=domain,dc=topdomain",filter=>"cn=mystring*");
Class to retrieve information from an LDAP catalogue server. It supports the most basic operations in a set of easy operations.
Instantiates the class.
Accepts the followng parameters:
server The LDAP-server address to connect to. Required.
dn Any DN-information to the LDAP-server such as username. Optional. Must be customized to the LDAP-server in question.
password Password to use when connectin as a user. Optional.
confidential Sets if the connection to the LDAP-server is to be secured or not? Optional. Defaults to 1. If set to 1 will attempt to upgrade the connection to a secure connection upon bind, if 0 it will use unencrypted ldap.
Returns the class instance.
Attempts to bind to the LDAP-server.
Accepts no input.
Returns 1 upon success, 0 upon failure. Please check the error()-method for more information upon failure.
Searches the LDAP catalogue for information.
Accepts to input in the following order:
base The base to use when searching the LDAP-catalogue. SCALAR.
filter The filter to use when searching the LDAP-catalogue. SCALAR.
Upon success returns a HASH-reference to a structure as follows:
(
0 => {
ATTRIBUTEa => VALUE,
.
.
ATTRIBUTEz => VALUE
}
1 => {
ATTRIBUTEa => VALUE,
.
.
ATTRIBUTEz => VALUE
}
)
where the primary keys are the numbered hits that it found (from 0 - N). The HASH may be empty if there were no hits.
Upon failure it will return undef. Please check the error()-method for more information.
Returns the last error message from the module.
Accepts no input.
Returns the last error message as a SCALAR.