Hi Uri,

On Friday 25 February 2005 10:29 am Liebeskind Uri (liu)  wrote:
> I do not understand Net::LDAP::Entry.
>
> Assuming that a ldap connection is set up:
> $ldap = Net::LDAP->new($dc) or die "Connection failed!", $@;
> $rc = $ldap->bind( $ldapAdmin, password => $pwd);
> die $rc->error if $rc->code;
>
> I read the example code of Net::LDAP::Entry but I do not understand  what
> it does.
>
> 01.  use Net::LDAP::Entry;
> 02.  $entry = Net::LDAP::Entry->new;
> 03.  $entry->add (
> 04.     attr1 => 'value1',
> 05.     attr2 => [ qw(value1 value2) ]
> 06.   );
> 07.
> 08.  $entry->update ( $ldap ); # update directory server
>
> As far as I understand the code:
> 02: create new ldap-entry object
> 03: populate object data structure with 2 attributes.
> 08: but here: what will be updated on the directory server?
>     There is no DN specified? It looks like "nirwana code".

You are right, the example should be improved.
>
> How can $entry be directly bound to a user object like
> $dn = "CN=x99,OU=Test,OU=OrgUsers,OU=DepartementX,DC=zhwin,DC=ch";
> without using $ldap->search?

Use $entry->dn($dn);

Hope it helps
Peter

PS: please do not reply personally but to the perl-ldap mailing list.


-- 
Peter Marschall
eMail: [EMAIL PROTECTED]

Reply via email to