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;
35
36 # Only continue if cookie is nonempty (= we're not done)
37 last if (!defined($cookie) || !length($cookie));
38
39 # Set cookie in paged control
40 $page->cookie($cookie);
41 }
42
43 if (defined($cookie) && length($cookie)) {
44 # We had an abnormal exit, so let the server know we do not want any more
45 $page->cookie($cookie);
46 $page->size(0);
47 $ldap->search( @args );
48 }
49
51 "Net::LDAP::Control::Paged" provides an interface for the creation and
52 manipulation of objects that represent the "pagedResultsControl" as
53 described by RFC 2696.
54
55 The control is allowed on LDAP search requests ("search" in Net::LDAP)
56 only. On other operations it will - depending on the value of the
57 parameter "critical" - either be ignored or lead to errors.
58
60 In addition to the constructor arguments described in
61 Net::LDAP::Control the following are provided.
62
63 cookie
64 The value to use as the cookie. This is not normally set when an
65 object is created, but is set from the cookie value returned by the
66 server. This associates a search with a previous search, so the
67 server knows to return the page of entries following the entries it
68 returned the previous time.
69
70 size
71 The page size that is required. This is the maximum number of
72 entries that the server will return to the search request.
73
75 As with Net::LDAP::Control each constructor argument described above is
76 also available as a method on the object which will return the current
77 value for the attribute if called without an argument, and set a new
78 value for the attribute if called with an argument.
79
81 Net::LDAP, Net::LDAP::Control, http://www.ietf.org/rfc/rfc2696.txt
82
84 Graham Barr <gbarr@pobox.com>
85
86 Please report any bugs, or post any suggestions, to the perl-ldap
87 mailing list <perl-ldap@perl.org>
88
90 Copyright (c) 2000-2004 Graham Barr. All rights reserved. This program
91 is free software; you can redistribute it and/or modify it under the
92 same terms as Perl itself.
93
94
95
96perl v5.28.1 2015-04-02 Net::LDAP::Control::Paged(3)