On 17 Feb 2011, at 17:10, Robert Threet wrote:

> I have a working Net::LDAP::Entry program for adding users so I decided
> to gut it to create a userPassword changer.
> 
> I keep getting "Error changing password: no objectClass attribute".
> 
> I cannot find examples doing simple one-at-a-time adds like this.  All I
> can find are examples using arrays and hashes and cannot seem to
> translate it to this.  Any tips?

There's a simple example right at the top of the Net::LDAP man page :-)

Or at <http://search.cpan.org/~gbarr/perl-ldap/lib/Net/LDAP.pod> if you prefer:

---
 $result = $ldap->add( 'cn=Barbara Jensen, o=University of Michigan, c=US',
                       attr => [
                         'cn'   => ['Barbara Jensen', 'Barbs Jensen'],
                         'sn'   => 'Jensen',
                         'mail' => 'b.jen...@umich.edu',
                         'objectclass' => ['top', 'person',
                                           'organizationalPerson',
                                           'inetOrgPerson' ],
                       ]
                     );

 $result->code && warn "failed to add entry: ", $result->error ;
---

Chris

Reply via email to