TAP::PARSER::ITERATOR(3pm)
π TAP::Parser::Iterator β bestie edition π
okay so real talk, this is TAP::Parser::Iterator, from the Perl Programmers Reference Guide, and it's the base class for TAP source iterators. Think of it as the blueprint, the moment before the glow-up, the parent class that all the actual iterator classes inherit their whole vibe from. β¨
πΈ VERSION πΈ
Version 3.50 β periodt, that's the one we're talking about.
β¨ SYNOPSIS β¨
like, if you wanna subclass it (and honestly, you might!), here's the shape of it:
# to subclass:
use TAP::Parser::Iterator ();
use base 'TAP::Parser::Iterator';
sub _initialize {
# see TAP::Object...
}
sub next_raw { ... }
sub wait { ... }
sub exit { ... }
see those { ... } bits? those are you-shaped holes, bestie. you fill 'em in. π
π¦ DESCRIPTION π¦
This is a simple iterator base class β lowkey does one job and does it β and that job is defining TAP::Parser's iterator API. that's it. that's the whole thing. π«Ά
and where do iterators actually come from, you ask? they're typically created from TAP::Parser::SourceHandlers. iykyk. β
π₯ METHODS π₯
π Class Methods π
newβ Creates an iterator. And guess what, you don't even have to write it yourself β it's provided byTAP::Object. slay, inherited behavior. π
π§ Instance Methods π§
nextβ the main character method, honestly:
while ( my $item = $iter->next ) { ... }
it iterates through it. of course it does. that's the whole assignment. π
next_rawβ β οΈ heads up: this method is abstract and should be overridden. no cap, you have to override it.
while ( my $item = $iter->next_raw ) { ... }
this one iterates raw input, meaning it does not apply any of the fixes for quirky input syntax. raw. unfiltered. no editing pass. π
handle_unicodeβ if necessary, this switches the input stream over to handle unicode. but note: it only has any effect for I/O handle based streams β the other kinds are just gonna sit there unbothered. π
and the default implementation? does nothing. literally nothing. zero. π
get_select_handlesβ returns a list of filehandles that may be used upstream in aselect()call, to signal that this Iterator is ready. iterators that are not handle-based should return an empty list β like, don't try it, bestie. π
the default implementation also does nothing. consistent queen. β¨
waitβ β οΈ abstract, should be overridden. again!!
my $wait_status = $iter->wait;
returns the wait status for this iterator. π¦
exitβ β οΈ abstract, should be overridden. yes, this one too, don't skip it.
my $wait_status = $iter->exit;
returns the exit status for this iterator. π
π SUBCLASSING π
okay so for the whole subclassing overview, go peek at "SUBCLASSING" in TAP::Parser` β that's where the full picture lives. π«Ά
but the rule for here is simple and i'm gonna say it plainly: you must override the abstract methods as noted above. all of 'em. no shortcuts, no "it'll probably work", none of that. π
πΈ Example πΈ
TAP::Parser::Iterator::Array is probably the easiest example to follow β it's giving approachable, it's giving readable, it's giving "yes you can do this too". and honestly? there's not much point repeating it here, so go read that one. π
β SEE ALSO β
TAP::ObjectTAP::ParserTAP::Parser::Iterator::ArrayTAP::Parser::Iterator::StreamTAP::Parser::Iterator::Process
and that's the page, bestie! π this lil icon comes to you from perl v5.42.3, dated 2026-11-03, and it's filed under TAP::Pa...Iterator(3pm) β go forth and iterate responsibly π
β¨π¦
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms