TAP::PARSER::AGGREGATOR(3perl)

πŸ’– TAP::Parser::Aggregator πŸ’–

okay so bestie, welcome to TAP::Parser::Aggregator β€” it's a piece of the Perl Programmers Reference Guide, and honestly? it's giving "backstage manager of the whole test suite." get comfy. πŸ“

✨ NAME ✨

TAP::Parser::Aggregator β€” because sometimes one parser just isn't enough and you need to aggregate all those TAP::Parser results into one gorgeous little pile. πŸ’…

🌸 VERSION 🌸

Version 3.52. periodt.

πŸ¦‹ SYNOPSIS πŸ¦‹

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 collects parser objects together and lets you report on, and query, their aggregate results. no cap. it's the group chat, and every parser is a member. 🫢

πŸŽ€ METHODS πŸŽ€

✨ Class Methods ✨

πŸ’« new

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

Returns a brand new TAP::Parser::Aggregator object. iconic behavior, truly. ⭐

🌈 Instance Methods 🌈

πŸ¦‹ add

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

The $description is usually a test file name β€” but that's only by convention, bestie, don't come for me. It gets used as a unique identifier (peep parsers if you wanna know why). And heads up: reusing a description is a fatal error. one description, one parser. that's the rule. πŸ’€

The $parser is a TAP::Parser object.

🧚 parsers

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

In scalar context with no arguments, you get back the number of parsers that got aggregated. In list context with no arguments, you get the parsers themselves, in the exact order they were added. chronology, slay. ✨

If @descriptions is passed, those correspond to the keys used in each add() call. You get an array of the requested parsers in the requested order in list context, or an array reference in scalar context.

lowkey important: requesting an unknown identifier is a fatal error. don't be messy. πŸ™ˆ

πŸ’œ descriptions

Get an array of descriptions β€” in the order they were added to the aggregator. first come, first served energy.

🌟 start

Call start immediately before adding any results to the aggregator. Among other things, it records the start time for the test run. it's the "okay we're starting" moment. 🎬

πŸŒ™ stop

Call stop immediately after adding all test results to the aggregator. that's a wrap, everyone go home. πŸŽ€

⏱️ elapsed

elapsed returns a Benchmark object representing the running time of the aggregated tests. But listen β€” for elapsed to actually be valid, you must call start before running the tests and stop immediately afterwards. no shortcuts, bestie. πŸ”₯

🎟️ elapsed_timestr

Returns a formatted string representing the runtime that elapsed() gave you. This lets you, the caller, not have to worry about Benchmark. so thoughtful of it honestly. ✨

βœ… all_passed

Returns true if all the tests passed and no parse errors were detected. clean sweep. ate. πŸ‘‘

πŸ“‹ get_status

Gets you a single word describing the status of the aggregated tests. Depending on how things went, it returns 'PASS', 'FAIL' or 'NOTESTS'. This token is understood by CPAN::Reporter. iykyk. 🀝

πŸ’… Summary methods πŸ’…

Each of these methods totally does the same trick: called in scalar context, it returns the total number of corresponding tests. Called in list context, it returns the descriptions of the parsers that contain the corresponding tests (go peek at add if you need the whole explanation of what a description is, bestie 🫢).

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

Like, for example, to find out how many tests unexpectedly succeeded (that's TODO tests which passed when they shouldn't have β€” the audacity 😭):

my $count        = $aggregate->todo_passed;
my @descriptions = $aggregate->todo_passed;
ngl, a note on the vibes: 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. don't read into it. πŸ“

🎯 total

my $tests_run = $aggregate->total;

Returns the total number of tests run. that's it, that's the tweet. ✨

🚨 has_problems

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

Identical to has_errors β€” BUT also returns true if any TODO tests unexpectedly succeeded. This one's more akin to warnings. it's the "everything's fine but also... hmm" detector. πŸ’€

❌ 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

all the worst hits, collected in one place. 😭

πŸ™ˆ 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 instead. deprecated, bestie β€” use todo_passed. let it go. πŸ¦‹


πŸ’œ See Also πŸ’œ

  • TAP::Parser
  • TAP::Harness

okay that's the whole page, you're all caught up bestie πŸ₯° this was perl v5.44.0, dated 2026-10-17, mwah πŸ’‹ go write some passing tests, ily 🫢✨

πŸ“¦ 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