WWW::Kickstarter::Iterator - Simple lazy lists
use WWW::Kickstarter; my $iter = WWW::Kickstarter::Iterator->new(\&fetcher); while (my ($item) = $iter->get()) { ... }
Provides a means of iterating over Kickstarter results without doing more web queries than necessary.
my $iter = WWW::Kickstarter::Iterator->new(); my $iter = WWW::Kickstarter::Iterator->new(\&generator); my $iter = WWW::Kickstarter::Iterator->new(\&generator, \@pre_generated);
Creates a lazy list iterator.
$generator is a reference to a subroutine which generates the next item of the list. It may return more than one item if it is convenient for it to do so. Returning an empty list signifies the end of the list.
$generator
$generator may be undefined if the pre-generated items define the list in its entirety.
my $done = my ($item) = $iter->get(); my $done = my @items = $iter->get($n);
Returns the next item in the list. If an argument is provided, returns that many items instead. If fewer than the requested number of items are are available, all remaining items are returned. If no more items are available, an empty list is returned.
my @items = $iter->get_rest();
Returns the remaining items of the list, if any.
my $done = my @items = $iter->get_chunk(); my $done = my @items = $iter->get_chunk($min);
This method is similar get, except it will return extra items if it is cheap to do so (i.e. if they have already been generated). This is useful if you have an iterator with expensive an generator (such as every iterator returned by WWW::Kickstarter) and if you don't care exactly how many items you get back.
get
See WWW::Kickstarter
To install WWW::Kickstarter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Kickstarter
CPAN shell
perl -MCPAN -e shell install WWW::Kickstarter
For more information on module installation, please visit the detailed CPAN module installation guide.