Text::...oWidth(3pm)
π Text::SimpleTable::AutoWidth β the manual, but make it cute π
okay so bestie, welcome to the Text::...oWidth(3pm) page β that's the shorthand name the manual wears when it's chilling in the perl docs, and the whole thing is called Text::SimpleTable::AutoWidth. And yes, the full NAME is literally doubled up like that, we're keeping it, it's giving maximalist π
β¨ NAME β¨
Text::SimpleTable::AutoWidth</purl> β Text::SimpleTable::AutoWidth - Simple eyecandy ASCII tables with auto-width selection β¨
π VERSION π
version 0.09
π¦ SYNOPSIS π¦
okay so here's the whole vibe, copy-paste ready:
use Text::SimpleTable::AutoWidth;
my $t1 = Text::SimpleTable::AutoWidth->new();
$t1->row( 'foobarbaz', 'yadayadayada' );
print $t1->draw;
.-----------+--------------.
| foobarbaz | yadayadayada |
'-----------+--------------'
my $t2 = Text::SimpleTable::AutoWidth->new();
$t2->captions( 'Foo', 'Bar' );
$t2->row( 'foobarbaz', 'yadayadayada' );
$t2->row( 'barbarbarbarbar', 'yada' );
print $t2->draw;
.-----------------+--------------.
| Foo | Bar |
+-----------------+--------------+
| foobarbaz | yadayadayada |
| barbarbarbarbar | yada |
'-----------------+--------------'
look at those little ASCII tables, they're so tidy, I'm obsessed ππ
πΈ DESCRIPTION πΈ
Simple eyecandy ASCII tables with auto-selection columns width, as seen in Catalyst. That's it, that's the whole pitch β you feed it rows, it figures out the widths itself, and you get a pretty table. Periodt. π
π METHODS π
π«Ά new(@attrs)
Inherited constructor from Moo. You can set following attributes:
fixed_widthβ set fixed width for resulting table. By default it's0, that's mean "don't fix width", so width of result table will depend on input data.
be warned bestie, thatfixed_widthwill include not only width of your data, but also all surronding characters, like spaces across values, table drawings (like'|') and hyphen (if wrapping is needed).
max_widthβ set maximum width for resulting table. By default it's0, that's mean "use default value". Default value is stored in$Text::SimpleTable::AutoWidth::WIDTH_LIMIT, and can be changed at any moment. Default value forWIDTH_LIMITis200.
same warning, no cap, thatmax_widthwill include not only width of your data, but also all surronding characters, like spaces across values, table drawings (like'|') and hyphen (if wrapping is needed).
NB: if you set fixed_width and max_width at same time, then you'll get table with fixed width, but not wider than max_width characters. both at once is valid, it's just a lil compromise β¨
captionsβArrayRef[Str]for captions in resulting table. πrowsβArrayRef[ArrayRef[Str]]for values in each row. You can use next method to add individual rows into table.
π row(@texts)
Add new row to table. Return $self, so you can write something like this β chaining goes hard:
print Text::SimpleTable::AutoWidth
->new( max_width => 55, captions => [qw/ Name Age /] )
->row( 'Mother', 59 )
->row( 'Dad', 58 )
->row( 'me', 32 )
->draw();
π draw()
Draw table. Really, just calculate column width, and then call Text::SimpleTable->draw(). the actual drawing is outsourced, she's just doing the math π
π§ GIT REPOSITORY π§
go clone it, bestie:
git clone git://github.com/cub-uanic/Text-SimpleTable-AutoWidth.git
β SEE ALSO β
Text::SimpleTable, Moo, Catalyst β the friend group π«Ά
π AUTHOR π
Oleg Kostyuk, "<cub#cpan.org>"
π COPYRIGHT & LICENSE π
Copyright by Oleg Kostyuk.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
π AUTHOR (again, bestie) π
Oleg Kostyuk <cub.uanic@gmail.com>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2015 by Oleg Kostyuk.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page, mwah π
cute sign-off time: this was perl v5.34.0, dated 2022-06-27, and the manual name on the tin is Text::...oWidth(3pm). slay, go make some eyecandy tables πβ¨π¦
π¦ where this page comes from
- debian bookworm: libtext-simpletable-autowidth-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtext-simpletable-autowidth-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-simpletable-autowidth-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-simpletable-autowidth-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-simpletable-autowidth-perl 0.09-2 Β· Artistic-1.0-Perl OR 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