Array:...tional(3pm)
π Array::Iterator::LegacyBiDirectional (3pm) π
okay bestie, welcome to the legacy corner of Array::Iterator land β this is the section 3pm manual page for Array::Iterator::LegacyBiDirectional, and yes it's the old-school one, but she still serves. πΈ
β¨ VERSION β¨
Version 0.136 β periodt. π
π SYNOPSIS π
use Array::Iterator::LegacyBiDirectional;
# create an instance of the iterator
my $i = Array::Iterator::LegacyBiDirectional->new(1 .. 100);
while ($some_condition_exists) {
# get the latest item from
# the iterator
my $current = $i->get_next();
# ...
if ($something_happens) {
# back up the iterator
$current = $i->get_previous();
}
}
π¦ DESCRIPTION π¦
so this is the old BiDirectional code. it's literally kept around for the users who want the old way that the pointer was kept. if you wanna know more, go read RT#126034 for the full tea. π«
now, sometimes an iterator just needs to go both ways β forward and backward, like a main character who refuses to be linear. π one example? token processing. when you're looping through tokens, sometimes you gotta move forward hunting for a match to a rule. and if the match fails, a bi-directional iterator can be moved back so the next rule can be tried. it's giving second chances. π
π METHODS π
this is a subclass of Array::Iterator, and lowkey only the methods that got added are documented here. for everything else, refer to the Array::Iterator documentation, bestie. π
has_previous([$n])β this method works much likehasNextdoes. it returns true (1) unless the beginning of the array has been reached, and false (0) otherwise. the optional argument has the same meaning except that it specifies the $nth previous element. πpreviousβ this method is much likenext. it returns the previous item in the iterator, and throws an exception if it attempts to reach past the beginning of the array. dramatic? yes. necessary? also yes. πget_previousβ this method is much likeget_next. it returns the previous item in the iterator, and returnsundefif it attempts to reach past the beginning of the array. soft launch rejection. πlook_back([$n])β this is the counterpart topeek. it returns the previous items in the iterator, but will not affect the internal counter. no touchy, just looky. π the optional argument has the same meaning except that it specifies the $nth previous element. β
π₯ SEE ALSO π₯
this is a subclass of Array::Iterator, so please refer to it for more documentation. she's the parent, respect her. π
π 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. π«Ά
ok that's the whole page, no cap. everything's here, nothing skipped β go forth and iterate in both directions, queen. π β¨
perl v5.40.1 Β· 2026-03-11 β mwah, thanks for reading, ily, bye bestie! πππ¦
π¦ 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