The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::FreshBooks::API::Iterator - FreshBooks Iterator objects

VERSION

version 0.24

SYNOPSIS

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;
    }

new

    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.

next

    my $next_result = $iterator->next(  );

Returns the next item in the iterator.

total

Returns the total number of results available, regardless of how many items are on the current page.

pages

Returns the total number of result pages

current_index

The item we are currently on

AUTHORS

  • Edmund von der Burg <evdb@ecclestoad.co.uk>

  • Olaf Alders <olaf@wundercounter.com>

COPYRIGHT AND LICENSE

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.