1Net::LDAP::Control::PreURseeard(C3o)ntributed Perl DocumNeentt:a:tLiDoAnP::Control::PreRead(3)
2
3
4
6 Net::LDAP::Control::PreRead - LDAPv3 Pre-Read control object
7
9 use Net::LDAP;
10 use Net::LDAP::Control::PreRead;
11 use Net::LDAP::Constant qw( LDAP_CONTROL_PREREAD LDAP_SUCCESS );
12
13 $ldap = Net::LDAP->new( "ldap.mydomain.eg" );
14
15 $preread = Net::LDAP::Control::PreRead->new( attrs => [ qw/givenName/ ] );
16
17 my $mesg = $ldap->modify( "cn=Barbara Jensen, o=University of Michigan, c=US",
18 replace => { givenName => "Babs" },
19 control => $preread );
20
21 if ($mesg->code eq LDAP_SUCCESS) {
22 my ($previous) = $mesg->control( LDAP_CONTROL_PREREAD );
23 my $entry = $previous ? $previous->entry() : undef;
24
25 if ($entry) {
26 print "givenName changed from '" .
27 join("', '", $entry->get_value(givenName") .
28 "' to 'Babs'\n");
29 }
30 }
31
33 "Net::LDAP::Control::PreRead" provides an interface for the creation
34 and manipulation of objects that represent the "Pre-Read Controls" as
35 described by RFC 4527.
36
37 In modification operations, the "Pre-Read request control" indicates to
38 the server that a copy of the original entry before the update is to be
39 returned. After the successful completion of the operation, the
40 accompanying "Pre-Read response control" allows one to retrieve the
41 original value from the server's response.
42
43 One use case of this control may be to obtain replaced or deleted
44 values of modified attributes or a copy of the entry being deleted.
45
47 In addition to the constructor arguments described in
48 Net::LDAP::Control the following are provided.
49
50 attrs => [ ATTR, ... ]
51 A list of attributes to be returned in the entry returned in the
52 response control.
53
54 If absent, all attributes are returned.
55
56 Operational attributes may be included in the list by explicitly
57 asking for them or by using special "+" feature (provided the
58 server supports this feature).
59
61 As with Net::LDAP::Control each constructor argument described above is
62 also available as a method on the object which will return the current
63 value for the attribute if called without an argument, and set a new
64 value for the attribute if called with an argument.
65
66 In addition to these methods, the control also supports the following
67 method:
68
69 entry ()
70 Returns the entry from the response control in the response message
71 to the LDAP request that contained the request control.
72
73 The result is either a Net::LDAP::Entry object or undefined.
74
76 Net::LDAP, Net::LDAP::Control, http://www.ietf.org/rfc/rfc4527.txt
77
79 Peter Marschall <peter@adpm.de>
80
81 Please report any bugs, or post any suggestions, to the perl-ldap
82 mailing list <perl-ldap@perl.org>
83
85 Copyright (c) 2008,2011 Peter Marschall. All rights reserved. This
86 program is free software; you can redistribute it and/or modify it
87 under the same terms as Perl itself.
88
89
90
91perl v5.36.0 2023-01-24 Net::LDAP::Control::PreRead(3)