<code> my $page = Net::LDAP::Control::Paged->new( size => 5, critical => 1 ); print Dumper($page); </code>
and got:
<output> $VAR1 = bless( { 'critical' => 1, 'type' => '1.2.840.113556.1.4.319', 'asn' => { 'cookie' => '', 'size' => 5 }, 'size' => 5 }, 'Net::LDAP::Control::Paged' ); pagect: 1 </output>
While I didn't get errors or warnings, there were no returned search results either. I also tried ActivePerl 5.6.1 with Net::LDAP 0.26 using the original program, but achieved the same original results. Apparently this is an iPlanet Directory Services issue? I'll check the docs and see if paged results are possible, but not enabled. I'd hate to have to rewrite that wheel. Thanks for replying,
--Jim
Graham Barr wrote:
Are you sure your server supports the paged results ? You did not mark it as critical, so
if the server does not support it then it will ignore it.
What happens if you add critical => 1 into the arguments for the ::Paged->new
Graham.
On Tuesday, Jul 22, 2003, at 15:04 US/Pacific, Jim Longino wrote:
Bob,
I'm using perl 5.8.0 (compiled from source) Net::LDAP version 0.28, and Net::LDAP::Control::Paged version 0.02, but still get all results (252) matches on one page.
I'm also using iPlanet Directory Server 5.1 sp2. Any suggestions? I need this to simplify the task of controlling an LDAP search application (web).
--Jim
[EMAIL PROTECTED] wrote:
I am a bit confused. I clipped out your code and made two changes: host (line 8) and search base (line 11) to talk to my directory. The code runs the way you expected. (I am using perl 5.6.1 and Net::LDAP version 0.28). I am afraid that I am at a loos as to why you are not seeing the right page breaks.
pagect: 7 31: cn => 'NOEL A SMITH' 32: cn => 'TIMOTHY R SMITH' 33: cn => 'CARRIE SMITH' 34: cn => 'Patricia Smith' 35: cn => 'Angela C Smith' pagect: 8 36: cn => 'MELVIN SMITH' 37: cn => 'KEVIN SMITH' 38: cn => 'SCOTT G SMITH' 39: cn => 'DENISE M SMITH' 40: cn => 'MARGIE MAE SMITH'
B
Bob Goolsby [EMAIL PROTECTED] (925) 979-7579
Jim Longino <[EMAIL PROTECTED]> 07/22/2003 10:44 AM
To Perl-ldap-dev Mailing List <[EMAIL PROTECTED]> cc
Subject Net::LDAP::Control::Paged problems
I spent a little time on this, but am not sure where the problem lies. Maybe I don't understand the purpose of the module. Here is the code, which is pretty similar to the example in the module documentation:
<code> #!/usr/local/bin/perl use strict; use warnings; use Net::LDAP; use Net::LDAP::Control::Paged; use Net::LDAP::Constant qw( LDAP_CONTROL_PAGED );
my $ldap = Net::LDAP->new( "host", version => 3 ); my $page = Net::LDAP::Control::Paged->new( size => 5 );
my @args = ( base => "DN", scope => "subtree", filter => "(surname=smith)", control => [ $page ], );
my $cookie; my $pagect = 0; my $entryct = 0; while ( my $results = $ldap->search( @args ) ) { $pagect++; print "pagect: $pagect\n"; $results->code and last;
foreach my $entry ($results->entries) { $entryct++; print " $entryct: cn => '", $entry->get_value('cn'), "'\n"; }
my ($response) = $results->control( LDAP_CONTROL_PAGED ) or last; $cookie = $response->cookie or last; $page->cookie($cookie); } </code>
My understanding is that the results should look somewhat like the following:
<desired output>
pagect: 1
1: cn => 'Betty L. Smith'
2: cn => 'Connie M Smith'
3: cn => 'Nelson L. Smith'
4: cn => 'Rhonda B. Smith'
5: cn => 'Sandra A. Smith'
pagect: 2
6: cn => 'Jason E. Smith'
7: cn => 'Amanda L. Smith'
8: cn => 'Shannon V. Smith'
9: cn => 'Jennifer E. Smith'
10: cn => 'Jennifer S. Smith'
pagect: 3
11: cn => 'Theresa M. Smith' </desired output>
but instead I get: <real output> pagect: 1 1: cn => 'Betty L. Smith' 2: cn => 'Connie M Smith' 3: cn => 'Nelson L. Smith' 4: cn => 'Rhonda B. Smith' 5: cn => 'Sandra A. Smith' 6: cn => 'Jason E. Smith' 7: cn => 'Amanda L. Smith' 8: cn => 'Shannon V. Smith' 9: cn => 'Jennifer E. Smith' 10: cn => 'Jennifer S. Smith' 11: cn => 'Theresa M. Smith' </real output>
Am I overlooking something simple? Thanks in advance for any advice,
Jim Longino Systems Analyst I University of South Alabama