Net::FreshBooks::API::Iterator - FreshBooks Iterator objects
version 0.24
You should never need to create an Iterator yourself. Iterators are created via
the
list() method. However, you should be aware that iterators do not
currently handle pagination for you. So, something like this will let you page
through your results.
my $page = 1;
my $per_page = 50;
while ( 1 ) {
my $invoices
= $fb->invoice->list( { page => $page, per_page => $per_page } );
while ( my $invoice = $invoices->next ) {
print $invoice->invoice_id . "\n";
}
last if $page >= $invoices->pages;
++$page;
}
my $iterator = $class->new(
{ parent_object => $parent_object,
args => {...},
}
);
Create a new iterator object. As part of creating the iterator a request is sent
to FreshBooks.
my $next_result = $iterator->next( );
Returns the next item in the iterator.
Returns the total number of results available, regardless of how many items are
on the current page.
Returns the total number of result pages
The item we are currently on
- •
- Edmund von der Burg <evdb@ecclestoad.co.uk>
- •
- Olaf Alders <olaf@wundercounter.com>
This software is copyright (c) 2011 by Edmund von der Burg & Olaf Alders.
This is free software; you can redistribute it and/or modify it under the same
terms as the Perl 5 programming language system itself.