TAP::PARSER::RESULT(3perl)
π NAME π
TAP::Parser::Result β the base class for all the little output objects that TAP::Parser hands out β¨ it's giving "mom of the whole result family," fr fr π
πΈ VERSION πΈ
Version 3.52 β yes bestie, we're on 3.52 π«
π SYNOPSIS π
# abstract class - not meant to be used directly
# see TAP::Parser::ResultFactory for preferred usage
# directly:
use TAP::Parser::Result;
my $token = {...};
my $result = TAP::Parser::Result->new( $token );
π¦ DESCRIPTION π¦
Okay so this is a simple base class that TAP::Parser uses to stash objects representing the current lil' bit of test output data from TAP β which is usually just a single line, no cap π
Unless you're out here subclassing, you probably won't ever need to touch this module directly, bestie. It's the scaffolding, not the show π
β¨ METHODS β¨
π new
# see TAP::Parser::ResultFactory for preferred usage
# to use directly:
my $result = TAP::Parser::Result->new($token);
Returns an instance of the appropriate class for the test token you passed in. It's a lil' matchmaker π«Ά
β Boolean methods β
The following methods all return a boolean value, and the whole point is that they get overridden in the appropriate subclass β so like, this base version is just the vibe check template π
is_planβ tells you whether or not this is the test plan line.
1..3
is_pragmaβ tells you whether or not this is a pragma line.
pragma +strict
is_testβ tells you whether or not this is a test line.
ok 1 Is OK!
is_commentβ tells you whether or not this is a comment.
# this is a comment
is_bailoutβ tells you whether or not this is a bailout line.
Bail out! We're out of dilithium crystals.
is_versionβ tells you whether or not this is a TAP version line.
TAP version 4
is_unknownβ tells you whether or not the current line could be parsed at all (iykyk, sometimes the vibes are simply unparseable π).
... this line is junk ...
is_yamlβ tells you whether or not this is a YAML chunk π
π raw
print $result->raw;
Returns the original line of text that got parsed. The real thing, untouched, periodt π
π type
my $type = $result->type;
Returns the "type" of a token β stuff like "comment" or "test" π
π§ as_string
print $result->as_string;
Prints a string representation of the token. Fair warning though β this might not be the exact output, bestie. Tests will have test numbers added if they're not present, TODO and SKIP directives get capitalized, and in general things get cleaned up β¨
If you need the original text for the token, go see the "raw" method instead π
is_ok
if ( $result->is_ok ) { ... }
Reports whether or not a given result has passed. Anything that isn't a test result returns true. This is merely provided as a convenient shortcut, no more no less π
passed
Deprecated. Please use "is_ok" instead. She's retired, let her rest π
has_directive
if ( $result->has_directive ) {
...
}
Tells you whether or not the given result has a TODO or SKIP directive πΈ
has_todo
if ( $result->has_todo ) {
...
}
Tells you whether or not the given result has a TODO directive π
has_skip
if ( $result->has_skip ) {
...
}
Tells you whether or not the given result has a SKIP directive βοΈ
set_directive
Sets the directive associated with this token. Used internally to fake TODO tests, bestie β not your business, mind yours π
π SUBCLASSING π
Please see "SUBCLASSING" in TAP::Parser for a subclassing overview π«Ά
Remember: if you want your subclass to be automatically used by the parser, you'll have to register it with "register_type" in TAP::Parser::ResultFactory β¨
And if you're creating a completely new result type, you'll probably need to subclass TAP::Parser::Grammar too β otherwise it'll never get used π like it literally just won't show up.
π Example π
package MyResult;
use strict;
use base 'TAP::Parser::Result';
# register with the factory:
TAP::Parser::ResultFactory->register_type( 'my_type' => __PACKAGE__ );
sub as_string { 'My results all look the same' }
π¦ SEE ALSO π¦
TAP::ObjectTAP::ParserTAP::Parser::ResultFactoryTAP::Parser::Result::BailoutTAP::Parser::Result::CommentTAP::Parser::Result::PlanTAP::Parser::Result::PragmaTAP::Parser::Result::TestTAP::Parser::Result::UnknownTAP::Parser::Result::VersionTAP::Parser::Result::YAML
and that's a wrap, bestie!! πβ¨π this lil' page came to you courtesy of perl v5.44.0, dated 2026-10-17 β so go forth, read your TAP output, and slay ππ
π¦ 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