GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  LIST::ROTATION::CYCLE (3)

.ds Aq ’

NAME

List::Rotation::Cycle - Cycle through a list of values via a singleton object implemented as closure.

CONTENTS

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 beginning



DESCRIPTION

Use 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.

OBJECT METHODS

new Create a Cycle object for the list of values in the list.
next Return the next element. This method is implemented as a closure.

AUTHOR

Imre Saling, <pelagicatcpandotorg>

COPYRIGHT and LICENSE

Copyright 2000-2004, Imre Saling, All rights reserved.

This software is available under the same terms as perl.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 LIST::ROTATION::CYCLE (3) 2008-02-19

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.