Shazbot!  Yes, that was my problem.  It returns a list.  Thanks.

AG


> -----Original Message-----
> From: Justin B. Alcorn [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 02, 2005 12:37 PM
> To: Giuoco, Aaron; perl-ldap@perl.org
> Subject: Re: Error when using Page Control
> 
> 
> In a process of deep contemplation, Giuoco, Aaron carefully 
> constucted 
> the following missive on 11/2/2005 12:02 PM:
> > Hi all,
> > 
> > I am trying to use the page control on a >1000 record LDAP 
> query.  I pretty much just copied the code from the examples 
> and modified it for my use, but I might have messed something 
> up.  The error I get when I run the program is:
> > 
> > Can't call method "cookie" without a package or object 
> reference at ldap_test.pl line 95, <DATA> line 461.
> > 
> > Here is the code around that line number:
> > 
> > 
> > 76. while(1) {
> > 77.   my $searchRes = $ldap->search( @searchArgs );
> > 78.   if ($searchRes->code == 0) {
> > 79.         foreach my $entry ($searchRes->entries) {
> >                     # Do stuff with the entry
> > 93.         }
> > 94.         my $resp = $searchRes->control( 
> LDAP_CONTROL_PAGED ) or last;
> > 95.         $cookie = $resp->cookie or last;
> > 96.         $page->cookie($cookie);
> > 97.   } else {
> > 98.         print LOG "Error with search:\n" . 
> $searchRes->error . "\n";
> > 99.         last;
> > 100.          }
> > 101. }
> > 
> > My script is processing the information inside the 
> foreach() correctly, but it errors out when it hits line 95.  
> Thanks in advance for any help you can provide.
> 
> 
>  From Net::LDAP::Message:
> 
> control ( OID, ... )
> 
>      Return a *list* of controls with the given OIDs that 
> were returned 
> from the server.
> 
> So you want:
> 
> my ($resp) = $searchRes->control( LDAP_CONTROL_PAGED ) or last;
> 
> Then $resp will contain the first (and only) control, which 
> is what you 
> want.  I got bit on the same problem, took more than a 1/2 hour to 
> realize the problem.
> 
> 

Reply via email to