Skip Menu |

This queue is for tickets about the NetSuite CPAN distribution.

Report information
The Basics
Id: 55662
Status: new
Priority: 0/
Queue: NetSuite

People
Owner: Nobody in particular
Requestors: paul.thomas [...] gradwell.net
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 1.03
Fixed in: (no value)



Subject: Minor documentation error
The example for searchNext reads - $ns->search('transaction', $query); if ($ns->searchResults->{totalPages} > 1) { while ($ns->searchResults->{pageIndex} != $ns->searchResults->{totalPages}) { for my $record (@{ $ns->searchResults->{recordList} }) { my $internalId = $record->{recordInternalId}; print "Found record with internalId $internalId\n"; } $ns->searchNext; } } using this loop condition appears to miss the last page because searchnext increments the pagenumber to equal $ns->searchResults->{totalPages} on the penultimate iteration and the last page is never processed. Example: if ($ns->searchResults->{totalPages} > 1) { while ($ns->searchResults->{pageIndex} != $ns->searchResults->{totalPages}) { print ("Using page ".$ns->searchResults->{pageIndex}." of ".$ns->searchResults->{totalPages}." total pages\n"); $ns->searchNext; } } yields: test:~# ./test.pl Using page 1 of 4 total pages Using page 2 of 4 total pages Using page 3 of 4 total pages test:~# I have used the following which seems to work: if ($ns->searchResults->{totalPages} > 1) { do { for my $record (@{ $ns->searchResults->{recordList} }) { my $internalId = $record->{recordInternalId}; print "Found record with internalId $internalId\n"; } while ($ns->searchNext); } cheers, Paul