/usr/share/perl5/Net/LDAP/Entry.pod is in libnet-ldap-perl 1:0.4300-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | =head1 NAME
Net::LDAP::Entry - An LDAP entry object
=head1 SYNOPSIS
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_value( $attr ) ), "\n";
}
}
# or
use Net::LDAP::Entry;
$entry = Net::LDAP::Entry->new;
$entry->dn($dn);
$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
$entry2 = $entry->clone; # copies entry
# new alternate syntax
$entry = Net::LDAP::Entry->new ( $dn
, attr1 => 'value1'
, attr2 => [ qw(value1 value2) ]
)->add(
attr3 => 'value'
)->update( $ldap );
=head1 DESCRIPTION
The B<Net::LDAP::Entry> object represents a single entry in the
directory. It is a container for attribute-value pairs.
A B<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 L<Net::LDAP::LDIF> module.
=head1 CONSTRUCTORS
=over 4
=item new ( )
Create a new entry object with the changetype set to C<'add'>.
Optionally, you can provide a DN and a list of arguments passed to the
add method.
Net::LDAP::Entry->new()
# or
Net::LDAP::Entry->new( $dn )
# or
Net::LDAP::Entry->new( $dn ,
objectClass => [qw( top posixAccount )] , uid => 'admin'
)
=item clone ( )
Returns a copy of the B<Net::LDAP::Entry> object.
=back
=head1 METHODS
=over 4
=item add ( ATTR =E<gt> VALUE, ... )
Add more attributes or values to the entry and returns the entry itself. Each
C<VALUE> should be a string if only a single value is wanted in the attribute,
or a reference to an array of strings if multiple values are wanted. The values
given will be added to the values which already exist for the given attributes.
$entry->add ( 'sn' => 'Barr' );
$entry->add ( 'street' => [ '1 some road','nowhere' ] );
B<NOTE>: these changes are local to the client and will not appear on
the directory server until the C<update> method is called. As C<add> returns the
entry, you can write something like.
$entry->add ( 'sn' => 'Barr' )->update( $ldap );
=item attributes ( OPTIONS )
Return a list of attributes in this entry
=over 4
=item nooptions =E<gt> 1
Return a list of the attribute names excluding any options. For
example for the entry
name: Graham Barr
name;en-us: Bob
jpeg;binary: **binary data**
then
@values = $entry->attributes;
print "default: @values\n";
@values = $entry->attributes ( nooptions => 1 );
print "nooptions: @values\n";
will output
default: name name;en-us jpeg;binary
nooptions: name jpeg
=back
=item changetype ( )
Returns the type of operation that would be performed when the update
method is called.
=item changetype ( TYPE )
Set the type of operation that will be performed when the update
method is called to C<TYPE>. Returns the entry itself.
Possible values for C<TYPE> are
=over 4
=item add
The update method will call the add method on the client object, which
will result in the entry being added to the directory server.
=item delete
The update method will call the delete method on the client object,
which will result in the entry being removed from the directory
server.
$entry->delete->update( $ldap )
=item modify
The update method will call the modify method on the client object,
which will result in any changes that have been made locally being
made to the entry on the directory server.
=item moddn/modrdn
The update method will call the moddn method on the client object,
which will result in any DN changes that have been made locally being
made to the entry on the directory server. These DN changes are
specified by setting the entry attributes newrdn, deleteoldrdn, and
(optionally) newsuperior.
=back
=item delete ( )
Delete the entry from the server on the next call to C<update>.
=item delete ( ATTR =E<gt> [ VALUE, ... ], ... )
Delete the values of given attributes from the entry. Values are
references to arrays; passing a reference to an empty array is the
same as passing C<undef>, and will result in the entire attribute
being deleted. For example:
$entry->delete ( 'mail' => [ 'foo.bar@example.com' ] );
$entry->delete ( 'description' => [ ], 'streetAddress' => [ ] );
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 dn ( )
Get the DN of the entry.
=item dn ( DN )
Set the DN for the entry, and return the previous value.
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 ldif ( OPTION =E<gt> VALUE, ... )
Returns the entry as an LDIF string. Possible options are
=over
=item change =E<gt> VALUE
If given a true value then the LDIF will be generated as a change record.
If false, then the LDIF generated will represent the entry content. If
unspecified then it will default to true if the entry has changes and
false if no changes have been applied to the entry.
=back
=item dump ( [ FILEHANDLE ] )
Dump the entry to the given filehandle.
This method is intended for debugging purposes and does not
treat binary attributes specially.
See L<Net::LDAP::LDIF> on how to generate LDIF output.
If C<FILEHANDLE> is omitted C<STDOUT> is used by default.
=item exists ( ATTR )
Returns C<TRUE> if the entry has an attribute called C<ATTR>.
=item get_value ( ATTR, OPTIONS )
Get the values for the attribute C<ATTR>. In a list context returns
all values for the given attribute, or the empty list if the attribute
does not exist. In a scalar context returns the first value for the
attribute or undef if the attribute does not exist.
=over 4
=item alloptions =E<gt> 1
The result will be a hash reference. The keys of the hash will be the
options and the hash value will be the values for those attributes.
For example if an entry had:
name: Graham Barr
name;en-us: Bob
Then a get for attribute "name" with alloptions set to a true value
$ref = $entry->get_value ( 'name', alloptions => 1 );
will return a hash reference that would be like
{
'' => [ 'Graham Barr' ],
';en-us' => [ 'Bob' ]
}
If alloptions is not set or is set to false only the attribute values
for the exactly matching name are returned.
=item asref =E<gt> 1
The result will be a reference to an array containing all the values
for the attribute, or C<undef> if the attribute does not exist.
$scalar = $entry->get_value ( 'name' );
$scalar will be the first value for the C<name> attribute, or C<undef>
if the entry does not contain a C<name> attribute.
$ref = $entry->get_value ( 'name', asref => 1 );
$ref will be a reference to an array, which will have all the values
for the C<name> attribute. If the entry does not have an attribute
called C<name> then $ref will be C<undef>.
=back
B<NOTE>: In the interest of performance the array references returned
by C<get_value> are references to structures held inside the entry
object. These values and thier contents should B<NOT> be modified
directly.
=item replace ( ATTR =E<gt> VALUE, ... )
Similar to C<add>, except that the values given will replace any
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 [, OPTIONS ] )
Update the directory server with any changes that have been made
locally to the attributes of this entry. This means any calls that
have been made to add, replace or delete since the last call to
changetype or update was made.
This method can also be used to modify the DN of the entry on the
server, by specifying moddn or modrdn as the changetype, and setting
the entry attributes newrdn, deleteoldrdn, and (optionally)
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.
=back
=head1 SEE ALSO
L<Net::LDAP>,
L<Net::LDAP::LDIF>
=head1 AUTHOR
Graham Barr E<lt>gbarr@pobox.comE<gt>.
Please report any bugs, or post any suggestions, to the perl-ldap
mailing list E<lt>perl-ldap@perl.orgE<gt>.
=head1 COPYRIGHT
Copyright (c) 1997-2004 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.
=cut
|