Skip to content
Browse files

LDAP.{pm,pod} new method done() as alias for unbind()

This alias helps to clean up the object the same way no matter whether
it is a Net::LDAP or a Net::LDAP::LDIF object.

This is mainly intended as a convenience function in cooperation
with Net::LDAP::Entry->update().

After the creation of the Net::LDAP resp. Net::LDAP::LDIF objects using
their respective constructors, changes can be done consistently using
Net::LDAP::Entry->update() and the objects can be cleaned up using their
bind() method.

This comes extremely handy when writing a client that offers the option
to simulate writes to the directory.
Simply use the Net::LDAP::LDIF object with the methods above the same way
you would use the Net::LDAP object, and you will get an LDIF file with
the simulated changes.
  • Loading branch information...
1 parent e7349a5 commit 8dae99878941104d66d1ded2aa5bfb466d74064d @marschap marschap committed Sep 3, 2012
Showing with 7 additions and 0 deletions.
  1. +2 −0 lib/Net/LDAP.pm
  2. +5 −0 lib/Net/LDAP.pod
View
2 lib/Net/LDAP.pm
@@ -340,6 +340,8 @@ sub unbind {
$ldap->_sendmesg($mesg);
}
+# convenience alias
+*done = &unbind;
sub ldapbind {
require Carp;
View
5 lib/Net/LDAP.pod
@@ -830,6 +830,11 @@ B<Example>
$mesg = $ldap->unbind;
+=item done ( )
+
+Convencience alias for C<unbind()>, named after the clean-up method
+of L<Net::LDAP::LDIF>.
+
=back
The following methods are for convenience, and do not return

0 comments on commit 8dae998

Please sign in to comment.
Something went wrong with that request. Please try again.