Hi all! After some playing with the module I've found out, that the type of the entity should be defined _before_ you are going to add or replace something in it. That should be mentioned in Net::LDAP::Entry pod, I think. So, if you do:
my $entry = Net::LDAP::Entry->new('DN'); $entry->add('givenName' => $1); $entry->changetype('modify')->update($ldap); It will not work (will simply do nothing). Instead one should write: my $entry = Net::LDAP::Entry->new('DN'); $entry->changetype('modify'); $entry->add('givenName' => $1); $entry->update($ldap); So, if one want the entry to be OK both for adding and for replacing do the following: my $entry = Net::LDAP::Entry->new('DN'); # 'add' is default changetype $entry->add('givenName' => $1); # only for addingg $entry->changetype('modify'); $entry->replace('mail' => $2); # for adding and updating $entry->add(...); $entry->update($ldap); Correct me, if I am wrong. Thanks! Dmitry Katsubo wrote on 11-05-2009 20:45: > Dear Perl LDAP users! > > I have some difficulties while trying to update the LDAP entry. I have > looked through the mail archive and I see that this topic is raised > quite often. > > Ideally I would like to create an entry, that I would like to use either > for adding or for updating (the choice is not known at the moment of > creation). I see from debug output, that "changetype=add", but I call > $ldap->modify() which should override this...