1Net::LDAP::Control::VLVU(s3e)r Contributed Perl DocumentaNteito:n:LDAP::Control::VLV(3)
2
3
4
6 Net::LDAP::Control::VLV - LDAPv3 Virtual List View control object
7
9 use Net::LDAP;
10 use Net::LDAP::Control::VLV;
11 use Net::LDAP::Constant qw( LDAP_CONTROL_VLVRESPONSE );
12
13 $ldap = Net::LDAP->new( "ldap.mydomain.eg" );
14
15 # Get the first 20 entries
16 $vlv = Net::LDAP::Control::VLV->new(
17 before => 0, # No entries from before target entry
18 after => 19, # 19 entries after target entry
19 content => 0, # List size unknown
20 offset => 1, # Target entry is the first
21 );
22 $sort = Net::LDAP::Control::Sort->new( order => 'cn' );
23
24 @args = ( base => "o=Ace Industry, c=us",
25 scope => "subtree",
26 filter => "(objectClass=inetOrgPerson)",
27 callback => \&process_entry, # Call this sub for each entry
28 control => [ $vlv, $sort ],
29 );
30
31 $mesg = $ldap->search( @args );
32
33 # Get VLV response control
34 ($resp) = $mesg->control( LDAP_CONTROL_VLVRESPONSE ) or die;
35 $vlv->response( $resp );
36
37 # Set the control to get the last 20 entries
38 $vlv->end;
39
40 $mesg = $ldap->search( @args );
41
42 # Get VLV response control
43 ($resp) = $mesg->control( LDAP_CONTROL_VLVRESPONSE ) or die;
44 $vlv->response( $resp );
45
46 # Now get the previous page
47 $vlv->scroll_page( -1 );
48
49 $mesg = $ldap->search( @args );
50
51 # Get VLV response control
52 ($resp) = $mesg->control( LDAP_CONTROL_VLVRESPONSE ) or die;
53 $vlv->response( $resp );
54
55 # Now page with first entry starting with "B" in the middle
56 $vlv->before(9); # Change page to show 9 before
57 $vlv->after(10); # Change page to show 10 after
58 $vlv->assert("B"); # assert "B"
59
60 $mesg = $ldap->search( @args );
61
63 "Net::LDAP::Control::VLV" provides an interface for the creation and
64 manipulation of objects that represent the Virtual List View as
65 described by draft-ietf-ldapext-ldapv3-vlv-09.txt.
66
67 When using a Virtual List View control in a search, it must be
68 accompanied by a sort control. See Net::LDAP::Control::Sort
69
71 In addition to the constructor arguments described in
72 Net::LDAP::Control the following are provided.
73
74 after
75 Set the number of entries the server should return from the list
76 after the target entry.
77
78 assert
79 Set the assertion value user to locate the target entry. This value
80 should be a legal value to compare with the first attribute in the
81 sort control that is passed with the VLV control. The target entry
82 is the first entry in the list which is greater than or equal the
83 assert value.
84
85 before
86 Set the number of entries the server should return from the list
87 before the target entry.
88
89 content
90 Set the number of entries in the list. On the first search this
91 value should be set to zero. On subsequent searches it should be
92 set to the length of the list, as returned by the server in the
93 VLVResponse control.
94
95 context
96 Set the context identifier. On the first search this value should
97 be set to zero. On subsequent searches it should be set to the
98 context value returned by the server in the VLVResponse control.
99
100 offset
101 Set the offset of the target entry.
102
103 METHODS
104 As with Net::LDAP::Control each constructor argument described above is
105 also available as a method on the object which will return the current
106 value for the attribute if called without an argument, and set a new
107 value for the attribute if called with an argument.
108
109 The "offset" and "assert" attributes are mutually exclusive. Setting
110 one or the other will cause previous values set by the other to be
111 forgotten. The "content" attribute is also associated with the "offset"
112 attribute, so setting "assert" will cause any "content" value to be
113 forgotten.
114
115 end Set the target entry to the end of the list. This method will
116 change the "before" and "after" attributes so that the target entry
117 is the last in the page.
118
119 response VLV_RESPONSE
120 Set the attributes in the control as per VLV_RESPONSE. VLV_RESPONSE
121 should be a control of type Net::LDAP::Control::VLVResponse
122 returned from the server. "response" will populate the "context",
123 "offset" and "content" attributes of the control with the values
124 from VLV_RESPONSE. Because this sets the "offset" attribute, any
125 previous setting of the "assert" attribute will be forgotten.
126
127 scroll NUM
128 Move the target entry by NUM entries. A positive NUM will move the
129 target entry towards the end of the list and a negative NUM will
130 move the target entry towards the start of the list. Returns the
131 index of the new target entry, or "undef" if the current target is
132 identified by an assertion.
133
134 "scroll" may change the "before" and "after" attributes if the
135 scroll value would cause the page to go off either end of the list.
136 But the page size will be maintained.
137
138 scroll_page NUM
139 Scroll by NUM pages. This method simple calculates the current page
140 size and calls "scroll" with "NUM * $page_size"
141
142 start
143 Set the target entry to the start of the list. This method will
144 change the "before" and "after" attributes to the target entry is
145 the first entry in the page.
146
148 Net::LDAP, Net::LDAP::Control, Net::LDAP::Control::Sort,
149 Net::LDAP::Control::VLVResponse
150
152 Graham Barr <gbarr@pobox.com>
153
154 Please report any bugs, or post any suggestions, to the perl-ldap
155 mailing list <perl-ldap@perl.org>
156
158 Copyright (c) 2000-2004 Graham Barr. All rights reserved. This program
159 is free software; you can redistribute it and/or modify it under the
160 same terms as Perl itself.
161
162
163
164perl v5.36.0 2023-01-24 Net::LDAP::Control::VLV(3)