Skip to content

Commit

Permalink
allow options to Net::LDAP::Entry->update(), patch originally
Browse files Browse the repository at this point in the history
by David M. Nesting, added documentation
  • Loading branch information
marschap committed Jun 10, 2004
1 parent a1cb225 commit 22fcb4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lib/Net/LDAP/Entry.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Net::LDAP::ASN qw(LDAPEntry);
use Net::LDAP::Constant qw(LDAP_LOCAL_ERROR);
use vars qw($VERSION);

$VERSION = "0.21_01";
$VERSION = "0.21_02";

sub new {
my $self = shift;
Expand Down Expand Up @@ -233,20 +233,20 @@ sub update {
my $cb = sub { $self->changetype('modify') unless $_[0]->code };

if ($self->{'changetype'} eq 'add') {
$mesg = $ldap->add($self, 'callback' => $cb);
$mesg = $ldap->add($self, 'callback' => $cb, @_);
}
elsif ($self->{'changetype'} eq 'delete') {
$mesg = $ldap->delete($self, 'callback' => $cb);
$mesg = $ldap->delete($self, 'callback' => $cb, @_);
}
elsif ($self->{'changetype'} =~ /modr?dn/) {
my @args = (newrdn => $self->get_value('newrdn'),
deleteoldrdn => $self->get_value('deleteoldrdn'));
my $newsuperior = $self->get_value('newsuperior');
push(@args, newsuperior => $newsuperior) if $newsuperior;
$mesg = $ldap->moddn($self, @args, 'callback' => $cb);
$mesg = $ldap->moddn($self, @args, 'callback' => $cb, @_);
}
elsif (@{$self->{'changes'}}) {
$mesg = $ldap->modify($self, 'changes' => $self->{'changes'}, 'callback' => $cb);
$mesg = $ldap->modify($self, 'changes' => $self->{'changes'}, 'callback' => $cb, @_);
}
else {
require Net::LDAP::Message;
Expand Down
5 changes: 4 additions & 1 deletion lib/Net/LDAP/Entry.pod
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ values that already exist for the given attributes.
B<NOTE>: these changes are local to the client and will not appear on
the directory server until the C<update> method is called.

=item update ( CLIENT )
=item update ( CLIENT [, OPTIONS ] )

Update the directory server with any changes that have been made
locally to the attributes of this entry. This means any calls that
Expand All @@ -275,6 +275,9 @@ newsuperior.

C<CLIENT> is a C<Net::LDAP> object where the update will be sent to.

C<OPTIONS> may be options to the C<Net::LDAP> actions on CLIENT
corresponding to the entry's changetype.

The result will be an object of type L<Net::LDAP::Message> as returned
by the add, modify or delete method called on CLIENT.

Expand Down

0 comments on commit 22fcb4b

Please sign in to comment.