NAME
Net::LDAP::Util - Utility functions
SYNOPSIS
use Net::LDAP::Util qw(ldap_error_text
ldap_error_name
ldap_error_desc
);
$mesg = $ldap->search( .... );
die "Error ",ldap_error_name($mesg->code) if $mesg->code;
DESCRIPTION
Net::LDAP::Util is a collection of utility functions for use with the Net::LDAP modules.
FUNCTIONS
- ldap_error_name ( NUM )
-
Returns the name corresponding with the error number passed in. If the error is not known the a string in the form
"LDAP error code %d(0x%02X)"
is returned. - ldap_error_text ( NUM )
-
Returns the text from the POD description for the given error. If the error code given is unknown then
undef
is returned. - ldap_error_desc ( NUM )
-
Returns a short text description of the error.
- canonical_dn ( DN )
-
Returns the given DN in a canonical form. Returns undef if DN is not a valid Distinguished Name
It performs the following operations on the given DN
Lowercases values that are # followed by hex.
Uppercases type names.
Removes the leading OID. characters if the type is an OID instead of a name.
Escapes all RFC 2253 special characters, and any other character where the ASCII code is <32 or >= 127, with a backslash and a two digit hex code.
Converts all leading and trailing spaces in values to be \20.
If an RDN contains multiple parts, the parts are re-ordered so that the attribute names are in alphabetical order.
Note values that are hex encoded (ie start with a #) are not decoded. So
SN=Barr
is not treated the same asSN=#42617272
AUTHOR
Graham Barr <gbarr@pobox.com>
COPYRIGHT
Copyright (c) 1999-2000 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
$Id: Util.pm,v 1.11 2001/04/12 16:40:40 gbarr Exp $