List::Rotation::Cycle

List::Rotation::Cycle allows to cycle through a list of values via a singleton object implemented as closure.
Download

List::Rotation::Cycle Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Imre Saling
  • Publisher web site:
  • http://search.cpan.org/~pelagic/List-Rotation-1.007/lib/List/Rotation.pm

List::Rotation::Cycle Tags


List::Rotation::Cycle Description

List::Rotation::Cycle allows to cycle through a list of values via a singleton object implemented as closure. List::Rotation::Cycle allows to cycle through a list of values via a singleton object implemented as closure.SYNOPSIS use List::Rotation::Cycle; my @array = qw( A B C ); my $first_cycle = List::Rotation::Cycle->new(@array); my $second_cycle = List::Rotation::Cycle->new(@array); print $first_cycle->next; ## prints A print $second_cycle->next; ## prints B print $first_cycle->next; ## prints C print $second_cycle->next; ## prints A, looping back to beginningUse List::Rotation::Cycle to loop through a list of values. Once you get to the end of the list, you go back to the beginning.List::Rotation::Cycle is implemented as a Singleton Pattern. You always just get 1 (the very same) Cycle object even if you use the new method several times. This is done by using Memoize on the new method. It returns the same object for every use of new that comes with the same List of parameters. Requirements: · Perl


List::Rotation::Cycle Related Software