1Net::LDAP::Control::VLVU(s3e)r Contributed Perl DocumentaNteito:n:LDAP::Control::VLV(3)
2
3
4

NAME

6       Net::LDAP::Control::VLV - LDAPv3 Virtual List View control object
7

SYNOPSIS

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

DESCRIPTION

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-03.txt.
66
67       When using a Virtual List View control in a search, it must be accompa‐
68       nied by a sort control. See Net::LDAP::Control::Sort
69

CONSTRUCTOR ARGUMENTS

71       In addition to the constructor arguments described in Net::LDAP::Con‐
72       trol 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 con‐
98           text value returned by the server in the VLVResponse control.
99
100       offset
101           Set the offset of the target entry.
102
103       METHODS
104
105       As with Net::LDAP::Control each constructor argument described above is
106       also avaliable as a method on the object which will return the current
107       value for the attribute if called without an argument, and set a new
108       value for the attribute if called with an argument.
109
110       The "offset" and "assert" attributes are mutually exclusive. Setting
111       one or the other will cause previous values set by the other to be for‐
112       gotten. The "content" attribute is also associated with the "offset"
113       attribute, so setting "assert" will cause any "content" value to be
114       forgotten.
115
116       end Set the target entry to the end of the list. This method will
117           change the "before" and "after" attributes so that the target entry
118           is the last in the page.
119
120       response VLV_RESPONSE
121           Set the attributes in the control as per VLV_RESPONSE. VLV_RESPONSE
122           should be a control of type Net::LDAP::Control::VLVResponse
123           returned from the server. "response" will populate the "context",
124           "offset" and "content" attibutes of the control with the values
125           from VLV_RESPONSE. Because this sets the "offset" attribute, any
126           previous setting of the "assert" attribute will be forgotten.
127
128       scroll NUM
129           Move the target entry by NUM entries. A positive NUM will move the
130           target entry towards the end of the list and a negative NUM will
131           move the target entry towards the start of the list. Returns the
132           index of the new target entry, or "undef" if the current target is
133           identified by an assertion.
134
135           "scroll" may change the "before" and "after" attributes if the
136           scroll value would cause the page to go off either end of the list.
137           But the page size will be maintained.
138
139       scroll_page NUM
140           Scroll by NUM pages. This method simple calculates the current page
141           size and calls "scroll" with "NUM * $page_size"
142
143       start
144           Set the target entry to the start of the list. This method will
145           change the "before" and "after" attributes to the the target entry
146           is the first entry in the page.
147

SEE ALSO

149       Net::LDAP, Net::LDAP::Control, Net::LDAP::Control::Sort,
150       Net::LDAP::Control::VLVResponse
151

AUTHOR

153       Graham Barr <gbarr@pobox.com>
154
155       Please report any bugs, or post any suggestions, to the perl-ldap mail‐
156       ing list <perl-ldap@perl.org>
157
159       Copyright (c) 2000-2004 Graham Barr. All rights reserved. This program
160       is free software; you can redistribute it and/or modify it under the
161       same terms as Perl itself.
162
163
164
165perl v5.8.8                       2007-02-10        Net::LDAP::Control::VLV(3)
Impressum