Test::S...m::Table(3)
π Test::Stream::Table β the perl manual page, but make it cute π
okay bestie, so this is Test::Stream::Table, from the User Contributed Perl Documentation corner of the perl universe. It's a little module whose whole job is turning a header plus a bunch of rows into an actual formatted table. no cap. π
β¨ NAME β¨
Test::Stream::Table β format a header and rows into a table π«Ά
π DEPRECATED π
okay so we need to talk. This distribution is deprecated in favor of Test2, Test2::Suite, and Test2::Workflow. she's retired, she's living her best life, she's not coming back. π
if you need to make the switch, go look at Test::Stream::Manual::ToTest2 β there's a whole conversion guide waiting for you there. π¦
πΈ DESCRIPTION πΈ
so basically this thing gets used by some failing tests to spill the tea about what went wrong β diagnostics, you know? and the module is able to generic format rows of data into tables. that's the vibe. that's the whole job. π
β¨ SYNOPSIS β¨
use Test::Stream::Table qw/table/;
my @table = table(
max_width => 80,
collapse => 1, # Do not show empty columns
header => [ 'name', 'age', 'hair color' ],
rows => [
[ 'Fred Flinstone', 2000000, 'black' ],
[ 'Wilma Flinstone', 1999995, 'red' ],
...,
],
);
# The @table array contains each line of the table, no newlines added.
say $_ for @table;
and this right here prints a table like this:
+-----------------+---------+------------+
| name | age | hair color |
+-----------------+---------+------------+
| Fred Flinstone | 2000000 | black |
| Wilma Flinstone | 1999995 | red |
| ... | ... | ... |
+-----------------+---------+------------+
look at those little plus signs holding it all together. iconic. π
π EXPORTS π
@rows = table(...)
the function returns a list of lines, and bestie listen β those lines do not have the newline "\n" character appended. you add those yourself, you're grown. π
here are the options, one by one, because we don't skip anything in this house:
header => [ ... ]β if you want a header, specify it here. it takes an arrayref, and each element is that column's heading. πrows => [ [...], [...], ... ]β this should be an arrayref containing an arrayref per row. rows within rows. it's giving nesting. πͺcollapse => $boolβ use this if you want ot hide empty columns, that is any column that has no data in any row. heads up: having a header for the column will not effect collapse. so a named-but-empty column is still out here taking up space. πmax_width => $numβ set the maximum width of the table. the table may not be this big, but it will be no bigger. if none is specified it will attempt to fidn the width of your terminal and use that, otherwise it falls back to80. she tries, okay? πsanitize => $boolβ this will sanitize all the data in the table such that newlines, control characters, and all whitespace except for ASCII20' 'are replaced with escape sequences. this prevents newlines, tabs, and similar whitespace from disrupting the table. no chaos allowed, periodt. π«mark_tail => $boolβ this will replace the last whitespace character of any trailing whitespace with its escape sequence. this makes it easier to notice trailing whitespace when comparing values. so sneaky invisible spaces get a little spotlight. β
π NOTE ON UNICODE/WIDE CHARATERS π
some unicode characters, such as "ε©§" ("U+5A67") are wider than others. these will render just fine if you use utf8; as necessary, and Unicode::GCString is installed, however if the module is not installed there will be anomolies in the table:
+-----+-----+---+
| a | b | c |
+-----+-----+---+
| ε©§ | x | y |
| x | y | z |
| x | ε©§ | z |
+-----+-----+---+
see how the columns are doing a little side-eye? yeah. install the module, bestie. π§
π₯ SOURCE π₯
the source code repository for Test::Stream can be found at http://github.com/Test-More/Test-Stream/. go be nosy, it's fine. π
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>
π AUTHORS π
- Chad Granum
<exodist@cpan.org>
π COPYRIGHT π
Copyright 2015 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
and that's the whole page, bestie. every flag, every default, every repo link, all of it. nothing skipped, nothing invented. π«Ά
this was perl v5.42.0 energy, dated 2025-07-25, straight out of the Test::S...m::Table(3) manual page β mwah, slay, bye π
β¨
π¦ where this page comes from
- fedora 43: perl-Test-Stream 1.302027-35.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms