Test2::...::Table(3pm)

Test2::...::Table(3pm) β€” hey bestie, this is the page from the Perl Programmers Reference Guide, and it’s all about Test2::EventFacet::Info::Table. Let’s get into it πŸ’…

🌸 NAME 🌸

Test2::EventFacet::Info::Table β€” intermediary representation of a table. Periodt.

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this is the intermediary representation of a table, bestie β€” it exists for use in specialized Test::API::Context methods that generate Test2::EventFacet::Info facets. That’s the whole vibe: a middle layer that helps those methods produce info facets. No cap.

✨ SYNOPSIS ✨

Here’s the exact synopsis, copy-paste core and all:

use Test2::EventFacet::Info::Table;
use Test2::API qw/context/;

sub my_tool {
    my $ctx = context();

    ...

    $ctx->fail(
        $name,
        "failure diag message",
        Test2::EventFacet::Info::Table->new(
            # Required
            rows => [['a', 'b'], ['c', 'd'], ...],

            # Strongly Recommended
            as_string => "... string to print when table cannot be rendered ...",

            # Optional
            header => ['col1', 'col2'],
            collapse => $bool,
            no_collapse => ['col1', ...],
        ),
    );

    ...

    $ctx->release;
}

my_tool();

πŸŽ€ ATTRIBUTES πŸŽ€

  • $header_aref = $t->header() β€” grabs the header aref, bestie.
  • $rows_aref = $t->rows() β€” grabs the rows aref.
  • $bool = $t->collapse() β€” the collapse boolean situation.
  • $aref = $t->no_collapse() β€” the no-collapse aref.

All four of the above are directly tied to the table hashref structure described in Test2::EventFacet::Info. That’s the link-up, iykyk.

  • $str = $t->as_string() β€” returns the string form of the table if it was set; otherwise it returns the string "<TABLE NOT DISPLAYED>". The way that fallback is literally iconic 😭
  • $href = $t->as_hash() β€” returns the data structure used for tables by Test2::EventFacet::Info.
  • %args = $t->info_args() β€” returns the arguments that should be used to construct the proper Test2::EventFacet::Info structure. And the actual return is:
return (table => $t->as_hash(), details => $t->as_string());

πŸ”₯ SOURCE πŸ”₯

The source code repository for Test2 can be found at <https://github.com/Test-More/test-more/>. Go look, bestie 🫢

πŸ‘‘ MAINTAINERS πŸ‘‘

  • Chad Granum <exodist@cpan.org>

πŸ’œ AUTHORS πŸ’œ

  • Chad Granum <exodist@cpan.org>

Copyright Chad Granum <exodist@cpan.org>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See <https://dev.perl.org/licenses/>.


okay that’s the whole manual page, bestie! πŸ’… Footer tea: perl v5.42.3, dated 2026-11-03 β€” mwah, go slay your tables 🫢✨

πŸ“¦ where this page comes from