TAP::PARSER::AGGREGATOR(3pm)

πŸ¦‹ NAME πŸ¦‹

TAP::Parser::Aggregator β€” Aggregate TAP::Parser results. This is the TAP::Parser::Aggregator(3pm) page from the Perl Programmers Reference Guide, and it's here to help you collect parser objects and ask them for group-chat-style aggregate results. πŸ’–

✨ VERSION ✨

Version 3.50 β€” yes bestie, that's the version.

🧚 SYNOPSIS 🧚

Here's the vibe in code:

use TAP::Parser::Aggregator;

my $aggregate = TAP::Parser::Aggregator->new;
$aggregate->add( 't/00-load.t', $load_parser );
$aggregate->add( 't/10-lex.t',  $lex_parser  );

my $summary = <<'END_SUMMARY';
Passed:  %s
Failed:  %s
Unexpectedly succeeded: %s
END_SUMMARY
printf $summary,
       scalar $aggregate->passed,
       scalar $aggregate->failed,
       scalar $aggregate->todo_passed;

πŸ’… DESCRIPTION πŸ’…

TAP::Parser::Aggregator is the collector bestie: it gathers parser objects and lets you do reporting/querying on their aggregate results. Slay. πŸ’–

🌈 METHODS 🌈

Okay, methods time. Keep your hands inside the ride, etc. ✨

πŸ’– Class Methods πŸ’–

new

my $aggregate = TAP::Parser::Aggregator->new;

Returns a fresh new TAP::Parser::Aggregator object. Iconic. ✨

πŸ¦‹ Instance Methods πŸ¦‹

add

$aggregate->add( $description => $parser );

$description is usually a test file name β€” but only by convention, no cap. It's used as a unique identifier (see e.g. parsers). Reusing a description is a fatal error, so don't try to make it a thing. πŸ’€

$parser is a TAP::Parser object. That's the whole add.

parsers

my $count   = $aggregate->parsers;
my @parsers = $aggregate->parsers;
my @parsers = $aggregate->parsers(@descriptions);

No args + scalar context: returns the number of parsers aggregated. No args + list context: returns the parsers in the order they were added.

If @descriptions is given, those correspond to the keys used in each call to add(). It returns an array of the requested parsers in the requested order in list context, or an array reference in scalar context. Requesting an unknown identifier is a fatal error β€” do not pass go. πŸ™ˆ

descriptions

Get an array of descriptions in the order in which they were added to the aggregator. Cute and chronological. πŸŽ€

start

Call start immediately before adding any results to the aggregator. Among other times, it records the start time for the test run. Clock starts now, bestie. ⏱️

stop

Call stop immediately after adding all test results to the aggregator. That's the cooldown. 🧘

elapsed

Returns a Benchmark object that represents the running time of the aggregated tests. For elapsed to be valid you must call start before running the tests and stop immediately afterwards. No start/stop, no valid elapsed β€” periodt. πŸ”₯

elapsed_timestr

Returns a formatted string representing the runtime returned by elapsed(). This lets the caller not worry about Benchmark. So thoughtful. 🫢

all_passed

Returns true if all the tests passed and no parse errors were detected. The dream. 🌈

get_status

Gets a single word describing the status of the aggregated tests. Depending on the outcome of the tests, returns 'PASS', 'FAIL' or 'NOTESTS'. This token is understood by CPAN::Reporter. πŸ‘‘

πŸ“ Summary methods πŸ“

Each of these methods returns the total number of corresponding tests if called in scalar context. If called in list context, it returns the descriptions of the parsers which contain the corresponding tests (see add for an explanation of description). Same rules, different counters. πŸ’…

  • failed
  • parse_errors
  • passed
  • planned
  • skipped
  • todo
  • todo_passed
  • wait
  • exit

For example, to find out how many tests unexpectedly succeeded (TODO tests which passed when they shouldn't):

my $count        = $aggregate->todo_passed;
my @descriptions = $aggregate->todo_passed;

Note that wait and exit are the totals of the wait and exit statuses of each of the tests. These values are totalled only to provide a true value if any of them are non-zero. That's the whole point, iykyk. 🧚

total

my $tests_run = $aggregate->total;

Returns the total number of tests run. Math, but make it fashion. ✨

has_problems

if ( $parser->has_problems ) {
    ...
}

Identical to has_errors, but also returns true if any TODO tests unexpectedly succeeded. This is more akin to warnings. It's giving "extra problem energy." 😭

has_errors

if ( $parser->has_errors ) {
    ...
}

Returns true if any of the parsers failed. This includes:

  • Failed tests
  • Parse errors
  • Bad exit or wait status

So if any of those show up, it's a whole situation. πŸ’€

todo_failed

# deprecated in favor of 'todo_passed'.  This method was horribly misnamed.

This was a badly misnamed method. It indicates which TODO tests unexpectedly succeeded. It will now issue a warning and call todo_passed. The rebrand is real. πŸ™ˆ

πŸ‘€ See Also πŸ‘€

  • TAP::Parser
  • TAP::Harness

xoxo, your Perl bestie πŸ’œ β€” this page is from perl v5.42.3, dated 2026-11-03, and yes, the footer says TAP::Pa...gregator(3pm). Take care of yourselves and your test suites. πŸŽ€

πŸ“¦ where this page comes from