TAP::P...plexer(3perl)

πŸ’… NAME πŸ’…

TAP::Parser::Multiplexer β€” multiplex multiple TAP::Parsers ✨

okay so bestie, imagine you've got a whole little squad of TAP parsers and you want them ALL feeding you results at once, no waiting around, no picking favorites. That's literally her. That's the whole job. πŸ‘‘

This is the TAP::Parser::Multiplexer page, btw, straight out of the Perl Programmers Reference Guide. iykyk.


🌸 VERSION 🌸

Version 3.52 β€” yes she's got a number, and yes she's iconic for it πŸ’–


✨ SYNOPSIS ✨

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 look at that loop, she's gorgeous, she just keeps going until everything's done 🌈


πŸ¦‹ DESCRIPTION πŸ¦‹

TAP::Parser::Multiplexer gathers input from multiple TAP::Parsers. That's the whole vibe β€” one mux, many parsers, all of them being watched at once. πŸ‘€

Internally it calls select on the input file handles for those parsers, so it can just wait until one or more of them actually has input ready to go. No busy-looping, no drama, just chilling until there's something to read. πŸ’…

If you want to see it out in the wild being used for real, go peek at TAP::Harness β€” that's the example, that's where she shines ✨


πŸŽ€ METHODS πŸŽ€

πŸ’œ Class Methods

  • "new"
my $mux = TAP::Parser::Multiplexer->new;

Returns a brand new TAP::Parser::Multiplexer object. Fresh out the box, no parsers in her yet, main character energy fr fr. 🫢

πŸ“ Instance Methods

  • "add"
$mux->add( $parser, $stash );

Adds a TAP::Parser to the multiplexer. $stash is an optional, opaque reference β€” like, we do not care what's inside it, that's your business β€” and it'll get handed back to you from "next" along with the parser and the next result. So it's basically a little name tag you tie to your parser so you remember which one is which. 🏷️✨

  • "parsers"
my $count   = $mux->parsers;

Returns the number of parsers. And here's the thing bestie β€” parsers get removed from the multiplexer once their input is exhausted. So this number goes down over time. She's not a hoarder, she lets go. πŸ¦‹

  • "next"

Returns a result from the next available parser. You get back a list with three things in it: the parser the result came from, the stash that corresponds with that parser, and the result itself.

my ( $parser, $stash, $result ) = $mux->next;

If $result is undefined, that means the corresponding parser has hit the end of its input β€” and it will automatically be removed from the multiplexer. Goodbye, queen, thanks for the TAP. πŸ‘‹

When all the parsers are exhausted, you'll get an empty list back. That's the signal that the whole party's over.

if ( my ( $parser, $stash, $result ) = $mux->next ) {
    if ( ! defined $result ) {
        # End of this parser
    }
    else {
        # Process result
    }
}
else {
    # All parsers finished
}

like the structure is literally right there, just read it, it's giving clear instructions πŸ’€


🌈 See Also 🌈

  • TAP::Parser
  • TAP::Harness

go read those too, they're the friends in this little friend group πŸ’–


and that's the page bestie!! 🌸 this was TAP::Parser::Multiplexer, page 3perl, for perl v5.44.0, dated 2026-10-17 β€” mwah, go multiplex something, you got this πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND 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