Andy Lester > List-Cycle-0.04 > List::Cycle

Download:
List-Cycle-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.04   Source  

NAME ^

List::Cycle - Objects for cycling through a list of values

VERSION ^

Version 0.04

SYNOPSIS ^

    use List::Cycle;

    my $color = List::Cycle->new( {values => ['#000000', '#FAFAFA', '#BADDAD']} );
    print $color->next; # #000000
    print $color->next; # #FAFAFA
    print $color->next; # #BADDAD
    print $color->next; # #000000

FUNCTIONS ^

new( {values => \@values} )

Creates a new cycle object, using @values.

The values keyword can be vals, if you like.

$cycle->set_values(\@values)

Sets the cycle values and resets the internal pointer.

$cycle->reset

Sets the internal pointer back to the beginning of the cycle.

    my $color = List::Cycle->new( {values => [qw(red white blue)]} );
    print $color->next; # red
    print $color->next; # white
    $color->reset;
    print $color->next; # red

$cycle->dump

Returns a handy string representation of internals.

$cycle->next

Gives the next value in the sequence.

AUTHOR ^

Andy Lester, <andy at petdance.com>

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc List::Cycle

You can also look for information at:

BUGS ^

Please report any bugs or feature requests to bug-list-cycle @ rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=List-Cycle. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS ^

List::Cycle is a playground that uses some of the ideas in Damian Conway's marvelous Perl Best Practices. http://www.oreilly.com/catalog/perlbp/ One of the chapters mentions a mythical List::Cycle module, so I made it real.

Thanks also to Ricardo SIGNES for patches.

COPYRIGHT & LICENSE ^

Copyright 2005 Andy Lester, All Rights Reserved.

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