Test2:...:Table(3perl)

✨ NAME ✨

Test2::EventFacet::Info::Table β€” bestie, it's the intermediary representation of a table πŸ’… (and yes, that's the whole name, it's from the 3perl manual, the Perl Programmers Reference Guide, she's fancy like that)


πŸŽ€ DESCRIPTION πŸŽ€

Okay so picture this: it's a table, right? But it's not a final table, it's the intermediary representation of a table 🌸 β€” the glow-up-in-progress version. It exists for use in those specialized Test2::API::Context methods that generate Test2::EventFacet::Info facets. So like, the middlewoman of tables. The table's table era. Iconic honestly.


πŸ¦‹ SYNOPSIS πŸ¦‹

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();

Look at that. rows is Required, fr fr, like you cannot skip it, the table needs cells bestie. as_string is Strongly Recommended (she's the backup outfit for when the table can't be rendered πŸ’ƒ). And then header, collapse, and no_collapse are all just vibing in the Optional section, no pressure. ✨


πŸ’– ATTRIBUTES πŸ’–

  • $header_aref = $t->header()
  • $rows_aref = $t->rows()
  • $bool = $t->collapse()
  • $aref = $t->no_collapse()

All of the above (yes, all four, the whole squad πŸ‘‘) are directly tied to the table hashref structure described over in Test2::EventFacet::Info. So like, no secret second meaning, they're just the structure's little representatives.

  • $str = $t->as_string() β€” this one hands you the string form of the table if it was set. And if it wasn't set? 😭 She returns the string "<TABLE NOT DISPLAYED>". That's it, that's the whole mood, no table for you.
  • $href = $t->as_hash() β€” returns the data structure used for tables by Test2::EventFacet::Info. The raw material. The blueprint. 🧚
  • %args = $t->info_args() β€” this gives you back the arguments that should be used to construct the proper Test2::EventFacet::Info structure. And here's exactly what it returns, character for character:
return (table => $t->as_hash(), details => $t->as_string());

Slay. It literally just wraps up the hash and the string and calls it a day. πŸ’…


πŸ“š SOURCE πŸ“š

The source code repository for Test2 can be found at <https://github.com/Test-More/test-more/>. Go look, it's giving open source, it's giving community 🫢


πŸ‘‘ MAINTAINERS πŸ‘‘

Chad Granum <exodist@cpan.org>


🌈 AUTHORS 🌈

Chad Granum <exodist@cpan.org> (same legend, twice, because respect ✨)


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 page bestie, every flag, every attribute, every <TABLE NOT DISPLAYED> β€” we kept the facts, we kept the vibe, no cap πŸ“

Sign-off szn πŸ’– β€” this was perl v5.44.0, dated 2026-10-17, and it's the Test2:...:Table(3perl) page from the Perl Programmers Reference Guide. Go build a table, main character. βœ¨πŸŽ€

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