NAME

Iterator::RoundRobin - The great new Iterator::RoundRobin!

SYNOPSIS

Why? Because its Great! And New!

use Iterator::RoundRobin;
my $rr = Iterator::RoundRobin->new(
  [qw/usera-1 usera-2 usera-3/],
  [qw/userb-1 userb-2 userb-3/]
);
while (my $user = $rr->next()) {
  print "User $user.\n";
}

FUNCTIONS

new

The new method returns an instantiated Iterator::RoundRobin object. This method does require at least one or more array refs to be passed in. It will fail (ungracefully) if those requirements are not met.

next

The next method returns the next item in the list. It does very little voodoo to determine where it gets the thing to return. It handles uneven lists and multiple lists fairly well.

isempty

This method is use internally to determine if there is anything left to return.

rebuildarrays

This method is used internally to rebuild the index when a given list is empty. Please don't call this outside of the object.

CAVEATS

This module keeps an internal list of items that have been marked 'completed' which may be a memory hog if you let it. To disable this tracking set the internal variable 'track_completed' as false after object creation.

my $iter = Iterator::RoundRobin->new( ... );
$iter->{'track_completed'} = 0;

AUTHOR

Nick Gerakines, <nick at gerakines.net>

BUGS

Please report any bugs or feature requests to the author.

ACKNOWLEDGEMENTS

This module was inspired by Data::RoundRobin. Thanks.

COPYRIGHT & LICENSE

Copyright 2006 Nick Gerakines, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.