1Net::LDAP::Control::PagUesde(r3)Contributed Perl DocumenNteatt:i:oLnDAP::Control::Paged(3)
2
3
4
6 Net::LDAP::Control::Paged - LDAPv3 Paged results control object
7
9 use Net::LDAP;
10 use Net::LDAP::Control::Paged;
11 use Net::LDAP::Constant qw( LDAP_CONTROL_PAGED );
12
13 $ldap = Net::LDAP->new( "ldap.mydomain.eg" );
14
15 $page = Net::LDAP::Control::Paged->new( size => 100 );
16
17 @args = ( base => "cn=subnets,cn=sites,cn=configuration,$BASE_DN",
18 scope => "subtree",
19 filter => "(objectClass=subnet)",
20 callback => \&process_entry, # Call this sub for each entry
21 control => [ $page ],
22 );
23
24 my $cookie;
25 while (1) {
26 # Perform search
27 my $mesg = $ldap->search( @args );
28
29 # Only continue on LDAP_SUCCESS
30 $mesg->code and last;
31
32 # Get cookie from paged control
33 my($resp) = $mesg->control( LDAP_CONTROL_PAGED ) or last;
34 $cookie = $resp->cookie or last;
35
36 # Set cookie in paged control
37 $page->cookie($cookie);
38 }
39
40 if ($cookie) {
41 # We had an abnormal exit, so let the server know we do not want any more
42 $page->cookie($cookie);
43 $page->size(0);
44 $ldap->search( @args );
45 }
46
48 "Net::LDAP::Control::Paged" provides an interface for the creation and
49 manipulation of objects that represent the "pagedResultsControl" as
50 described by RFC 2696.
51
52 The control is allowed on LDAP search requests ("search" in Net::LDAP)
53 only. On other operations it will - depending on the value of the
54 parameter "critical" - either be ignored or lead to errors.
55
57 In addition to the constructor arguments described in
58 Net::LDAP::Control the following are provided.
59
60 cookie
61 The value to use as the cookie. This is not normally set when an
62 object is created, but is set from the cookie value returned by the
63 server. This associates a search with a previous search, so the
64 server knows to return the page of entries following the entries it
65 returned the previous time.
66
67 size
68 The page size that is required. This is the maximum number of
69 entries that the server will return to the search request.
70
72 As with Net::LDAP::Control each constructor argument described above is
73 also available as a method on the object which will return the current
74 value for the attribute if called without an argument, and set a new
75 value for the attribute if called with an argument.
76
78 Net::LDAP, Net::LDAP::Control, http://www.ietf.org/rfc/rfc2696.txt
79
81 Graham Barr <gbarr@pobox.com>
82
83 Please report any bugs, or post any suggestions, to the perl-ldap
84 mailing list <perl-ldap@perl.org>
85
87 Copyright (c) 2000-2004 Graham Barr. All rights reserved. This program
88 is free software; you can redistribute it and/or modify it under the
89 same terms as Perl itself.
90
91
92
93perl v5.16.3 2013-06-07 Net::LDAP::Control::Paged(3)