Manual

- Overview
- Tutorials
- FAQs
- History / Changes
- License

Reference

- Language
- Functions
- Operators
- Special Variables
- Pragmas
- Utilities
- Internals
- Platform Specific

Modules

- A • B • C • D • E
- F • G • H • I • L
- M • N • O • P • S
- T • U • X

News / Blogs

- Perl Buzz
- Perl Iron Man
- Perlsphere
- Planet Perl
- TPF news
- Use Perl

See also

- CPAN
- Perl.org
- Perl.com
- Perl 5 Wiki
- Perl Jobs
- Perl Mongers
- Perl Monks

Contact

- Site designed and maintained by Jon Allen (JJ)
- http://perl.jonallen.info

- View the project page and FAQs

# TAP::Parser::Multiplexer

Perl 5 version 10.1 documentation
Go to top • Show page index • Download PDF

# TAP::Parser::Multiplexer

- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- METHODS
  - Class Methods
  - Instance Methods
- See Also

# NAME

TAP::Parser::Multiplexer - Multiplex multiple TAP::Parsers

# VERSION

Version 3.17

# 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    }

# DESCRIPTION

`TAP::Parser::Multiplexer` gathers input from multiple TAP::Parsers. Internally it calls select on the input file handles for those parsers to wait for one or more of them to have input available.

See TAP::Harness for an example of its use.

# METHODS

## Class Methods

### `new`

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

Returns a new `TAP::Parser::Multiplexer` object.

## Instance Methods

### `add`

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

Add a TAP::Parser to the multiplexer. `$stash` is an optional opaque reference that will be returned from `next` along with the parser and the next result.

### `parsers`

      my $count   = $mux->parsers;

Returns the number of parsers. Parsers are removed from the multiplexer when their input is exhausted.

### `next`

Return a result from the next available parser. Returns a list containing the parser from which the result came, the stash that corresponds with that parser and the result.

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

If `$result` is undefined the corresponding parser has reached the end of its input (and will automatically be removed from the multiplexer).

When all parsers are exhausted an empty list will be returned.

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

# See Also

TAP::Parser

TAP::Harness

Page index

- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- METHODS
  - Class Methods
  - Instance Methods
- See Also

Recently read

Tools

- Preferences