Text::...atTable(3pm)
β¨ NAME β¨
Text::FormatTable β bestie, it formats text tables π (and yeah, this page lives in the User Contributed Perl Documentation part of the Text::...atTable(3pm) manpage, so you're in the right place π«Ά)
πΈ SYNOPSIS πΈ
my $table = Text::FormatTable->new('r|l');
$table->head('a', 'b');
$table->rule('=');
$table->row('c', 'd');
print $table->render(20);
π DESCRIPTION π
Okay so here's the vibe: Text::FormatTable renders simple tables as text. You hand the constructor (new) a table format spec that's giving very LaTeX, like "r|l|5l|R|20L", and then you call methods to fill in the table data and drop in rules. Once all the data is in, you call the render method and boom β your table gets formatted as text. Iconic behavior fr fr β¨
Methods, let's go:
π new($format)
Create a Text::FormatTable object. The format of each column is specified as a character of the $format string. The following formats are defined:
lβ Left-justified, top aligned, word-wrapped text.Lβ Left-justified, bottom aligned, word-wrapped text.rβ Right-justified, top aligned, word-wrapped text.Rβ Right-justified, bottom aligned, word-wrapped text.10R,20r,15L,12lβ the number is the fixed width of the column. Justified and aligned word-wrapped text (see above π). So like, number + letter = fixed width + alignment combo, iykyk.' 'β a space. Literally just a space π«§|β column separator.
π¦ head($col1, $col2, ...)
Add a header row using $col1, $col2, etc. as cell contents. Heads up bestie: at the moment, header rows are treated like normal rows. No special treatment, no cap π
π row($col1, $col2, ...)
Add a row with $col1, $col2, etc. as cell contents.
π rule([$char])
Add a horizontal rule. If $char is specified, it's used as the character to draw the rule with. Otherwise - gets used. Cute divider energy, but make it your own character β¨
π render([$screen_width])
Return the rendered table, formatted with $screen_width β or 79 if it isn't specified. Default queen behavior π
π SEE ALSO π
Text::ASCIITable
π COPYRIGHT π
Copyright (c) 2001-2004 Swiss Federal Institute of Technology, Zurich. (c) 2009 Trey Harris All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π§ CODE REPOSITORY π§
Git - http://github.com/treyharris/Text-FormatTable/tree/master
π AUTHOR π
David Schweikert <dws@ee.ethz.ch>
Maintained by Trey Harris <treyharris@gmail.com>
Fixed column width and bottom alignment written by Veselin Slavov <vslavov@creditreform.bg>
Okay that's the whole page, bestie, no notes, we ate π½οΈβ¨ This one came from perl v5.36.0, dated 2022-11-20, in the Text::...atTable(3pm) manpage β go format some tables, you got this π
π
π¦ where this page comes from
- debian bookworm: libtext-formattable-perl 1.03-3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- debian trixie: libtext-formattable-perl 1.03-3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- ubuntu noble: libtext-formattable-perl 1.03-3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- ubuntu resolute: libtext-formattable-perl 1.03-3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- ubuntu stonking: libtext-formattable-perl 1.03-3 Β· 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