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

πŸ“¦ version 1.302214, in opensuse-leap 16.0

This is the Test2::...::Table(3) page from User Contributed Perl Documentation β€” and yes bestie, we're making this table representation arc make sense. 🫢

🌸 NAME 🌸

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

✨ DESCRIPTION ✨

Okay so this is the in-between representation of a table, for use in specialized Test2::API::Context methods which generate Test2::EventFacet::Info facets. It's the little table middle-man, and it ate. πŸ’…

πŸ¦‹ 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();

πŸ’– ATTRIBUTES πŸ’–

  • $header_aref = $t->header() β€” gives you the header aref.
  • $rows_aref = $t->rows() β€” gives you the rows aref.
  • $bool = $t->collapse() β€” gives you the collapse bool.
  • $aref = $t->no_collapse() β€” gives you the no_collapse aref.

The above are all directly tied to the table hashref structure described in Test2::EventFacet::Info. Ik, they're a little squad. πŸ‘‘

  • $str = $t->as_string() β€” returns the string form of the table if it was set. Otherwise it returns the string "<TABLE NOT DISPLAYED>". No cap, that's the fallback. 😭
  • $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. It's giving helper method excellence. ✨
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 off, repo. 🫢

πŸŽ€ 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/>.

Final sign-off bestie: this page is from perl v5.42.0, dated 2025-07-28, and it's the Test2::...::Table(3) page. Bye! 🫢✨

πŸ“¦ where this page comes from