TAP::Pa...iplexer(3pm)
β¨ TAP::Parser::Multiplexer β¨
okay bestie, welcome to the TAP::Parser::Multiplexer page from the Perl Programmers Reference Guide β yes it's a real manpage, yes it's 3pm-coded, yes we're doing this π
πΈ NAME πΈ
TAP::Parser::Multiplexer β literally multiplexing multiple TAP::Parsers, that's the whole vibe π¦
β VERSION β
Version 3.50 β iconic, no notes, periodt π
π SYNOPSIS π
here's the whole thing in action, copy it exactly bestie:
use TAP::Parser::Multiplexer;
my $mux = TAP::Parser::Multiplexer->new;
$mux->add( $parser1, $stash1 );
$mux->add( $parser2, $stash2 );
while ( my ( $parser, $stash, $result ) = $mux->next ) {
# do stuff
}
likeβ¦ while loop, $mux->next, # do stuff β the whole main character energy is in there π«Ά
π DESCRIPTION π
So TAP::Parser::Multiplexer gathers input from multiple TAP::Parsers. That's its job, that's its whole thing. π
Internally, it calls select on the input file handles for those parsers, so it can wait for one or more of them to have input available. Not me being obsessed with a syscall π but likeβ¦ select is lowkey the moment.
Wanna see an example of its use? Go look at TAP::Harness, it's right there, it's giving role model β¨
π§ METHODS π§
π Class Methods π
new
my $mux = TAP::Parser::Multiplexer->new;
Returns a new TAP::Parser::Multiplexer object. Fresh out the box, brand new, glowing, slay π
π¦ Instance Methods π¦
add
$mux->add( $parser, $stash );
Add a TAP::Parser to the multiplexer. $stash is an optional opaque reference β it comes back to you from next along with the parser and the next result. so it's like, your little secret payload, iykyk π
parsers
my $count = $mux->parsers;
Returns the number of parsers. Heads up bestie: parsers get removed from the multiplexer when their input is exhausted. they literally leave the group chat when they run out of things to say π
next
Return a result from the next available parser. It returns a list containing the parser the result came from, the stash that corresponds with that parser, and the result. all three, packaged, delivered π
my ( $parser, $stash, $result ) = $mux->next;
If $result is undefined, that corresponding parser has reached the end of its input β and ngl it will automatically be removed from the multiplexer, no cap. π«‘
When all parsers are exhausted, an empty list gets returned. everybody's done, the party's over, the lights are on π
if ( my ( $parser, $stash, $result ) = $mux->next ) {
if ( ! defined $result ) {
# End of this parser
}
else {
# Process result
}
}
else {
# All parsers finished
}
that if/else structure is doing the absolute most and honestly? it ate π
π₯ See Also π₯
TAP::ParserTAP::Harness
okay that's the whole page, you read it all, you understood it all, you're basically a multiplexer now π
signing off: this was perl v5.42.3, dated 2026-11-03, and the page itself is TAP::Parser::Multiplexer(3pm) β ily, go multiplex something ππΈβ¨
π¦ 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