Array:...ircular(3pm)
Array::Iterator::Circular π« β the iterator that never says goodbye
okay bestie, so this is the docs for Array::Iterator::Circular, which lives in the User Contributed Perl Documentation corner of the manual. It's tiny, it's iconic, and it does exactly one unhinged little thing: it loops forever. π¦
β¨ VERSION β¨
Version 0.136 π
πΈ SYNOPSIS πΈ
use Array::Iterator::Circular;
# create an instance with a
# small array
my $color_iterator = Array::Iterator::Circular->new(qw(red green blue orange));
# this is a large list of
# arbitrary items
my @long_list_of_items = ( ... );
# as we loop through the items ...
foreach my $item (@long_list_of_items) {
# we assign color from our color
# iterator, which will keep dispensing
# as it loops through its set
$item->set_color($color_iterator->next());
}
# tell us how many times the set
# was looped through
print $color_iterator->get_loop_count();
likeβ¦ look at her. red, green, blue, orange, and then? red again. no cap. π
π DESCRIPTION π
This iterator will loop continuously as long as next or get_next is called. The has_next method will always return true (1), since the list will always loop back.
It's giving β¨infinite contentβ¨, and it is so useful when you need a list to repeat itself but you don't want to (or simply don't care to) know that it's doing so. lowkey the whole point. periodt. π
π METHODS π
This is a subclass of Array::Iterator, so only the methods that got added or changed get documented down here β for everything else, go read the Array::Iterator docs, bestie. π«Ά
has_nextβ since we endlessly loop, this will always return true (1). Like, always. It's never not true. πnextβ hands you the next item in the array, and once it hits the end of the array? it loops right back to the beginning again. the circle of life fr fr. π₯get_nextβ this one is now defined in terms ofnext. Since neither of them ever stops dispensing items, there's no need to tell them apart anymore. twins. πis_startβ if at any point during your looping you're like "wait, did I come back to the start of my list?", you just ask this method. vibe check for the beginning. πΈis_endβ same energy, other end: if at any point during your looping you wanna know whether you've gotten to the end of your list, you ask this method. β¨get_loop_countβ tells you how many times the iterator has looped back to its start. the receipts. the score.printit and feel something. π
π SEE ALSO π
This is a subclass of Array::Iterator, so please refer to that one for more documentation. it's literally the parent. show some respect. π
π§ MAINTAINER π§
Nigel Horne, "<njh at nigelhorne.com>"
2025-2026
β ORIGINAL AUTHOR β
stevan little, <stevan@iinteractive.com>
π ORIGINAL COPYRIGHT AND LICENSE π
Copyright 2004 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
so basically: use it, remix it, ship it β same terms as Perl itself. understood? π
okay that's the whole page, bestie. π this fine piece of documentation was served up by perl v5.40.1 on 2026-03-11, and that's the <rainbow>Array::Iterator::Circular(3pm)</rainbow> moment β looping back around to the start, forever and ever, exactly like the module intended. slay. π
β¨π¦
π¦ where this page comes from
- ubuntu stonking: libarray-iterator-perl 0.136-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms