TaskPipe::Iterator - generic class for TaskPipe Iterators
If you are creating an iterator, you can either get a new instance of a generic iterator and then supply the subs:
my $iterator = TaskPipe::Iterator->new( next => sub{ #... }, count => sub { #... }, reset => sub { # ... } );
or you can inherit from TaskPipe::Iterator and override the subs. All 3 subs must be provided - however
This sub should iterate the record pointer and return the next record
This sub should reset the record pointer to the first record.
Optional. If you know how many records you are expecting, then this sub should return this value. Including count offers a small performance boost by using the parent thread to execute the last record instead of idling. If the total number of records is not known in advance (often the case with iterators) then this sub should return -1. A sub that returns -1 is the default - so you can just omit this attribute if you don't have a way to calculate the total number of results.
count
Tom Gracey <tomgracey@gmail.com>
Copyright (c) Tom Gracey 2018
TaskPipe is free software, licensed under
The GNU Public License Version 3
To install TaskPipe, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TaskPipe
CPAN shell
perl -MCPAN -e shell install TaskPipe
For more information on module installation, please visit the detailed CPAN module installation guide.