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::Object
  • TAP::Parser
  • TAP::Parser::ResultFactory
  • TAP::Parser::Result::Bailout
  • TAP::Parser::Result::Comment
  • TAP::Parser::Result::Plan
  • TAP::Parser::Result::Pragma
  • TAP::Parser::Result::Test
  • TAP::Parser::Result::Unknown
  • TAP::Parser::Result::Version
  • TAP::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