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. π
failedparse_errorspassedplannedskippedtodotodo_passedwaitexit
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::ParserTAP::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
- 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