Net::LDAP::Entry -- An LDAP entry object |
Net::LDAP::Entry -- An LDAP entry object
use Net::LDAP;
$ldap = Net::LDAP->new($host); $mesg = $ldap->search(@search_args);
my $max = $mesg->count; for($i = 0 ; $i < $max ; $i++) { my $entry = $mesg->entry($i); foreach my $attr ($entry->attributes) { print join("\n ",$attr, $entry->get($attr)),"\n"; } }
# or
use Net::LDAP::Entry;
$entry = Net::LDAP::Entry->new;
$entry->add( attr1 => 'value1', attr2 => [qw(value1 value2)] );
$entry->delete( 'unwanted' );
$entry->replace( attr1 => 'newvalue' attr2 => [qw(new values)] );
$entry->update( $ldap ); # update directory server
The Net::LDAP::Entry object represents a single entry in the directory. It is a container for attribute-value pairs.
A Net::LDAP::Entry object can be used in two situations. The first and probably most common use is in the result of a search to the directory server.
The other is where a new object is created locally and then a single command is sent to the directory server to add, modify or replace an entry. Entries for this purpose can also be created by reading an LDIF file with the the Net::LDAP::LDIF manpage module.
$entry->add( 'sn' => 'Barr');
$entry->add( 'street' => [ '1 some road','nowhere']);
NOTE: these changes are local to the client and will not
appear on the directory server until the update
method
is called.
NOTE: these changes are local to the client and will not
appear on the directory server until the update
method
is called.
NOTE: these changes are local to the client and will not
appear on the directory server until the update
method
is called.
dn
will return
the current DN. If an argument is given then it will change the DN
for the entry and return the previous value.
NOTE: these changes are local to the client and will not
appear on the directory server until the update
method
is called.
CLIENT should be a Net::LDAP
object where the update
should be sent to.
CLIENT is only optional is the Net::LDAP::Entry object was created by a search on a directory server. In which case, if omitted, the update will be sent back to the same server.
The result will be an object of type Net::LDAP::Message
as returned
by the add, modify or delete method called on CLIENT.
undef
will be returned.
Possible values for TYPE are
the Net::LDAP manpage, the Net::LDAP::LDIF manpage
Graham Barr <gbarr@pobox.com>.
Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@mail.med.cornell.edu>.
Copyright (c) 1997-2000 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Net::LDAP::Entry -- An LDAP entry object |