Catman...::Table(3pm)
π NAME π
okay so bestie, welcome to the manual page for Catmandu::Exporter::Table β the ASCII/Markdown table exporter. It lives in the Perl docs as Catman...::Table(3pm) and it is, no exaggeration, the moment. π«Ά
β¨ SYNOPSIS β¨
With the catmandu command line client π
echo '{"one":"my","two":"table"} {"one":"is","two":"nice"}' | \
catmandu convert JSON --multiline 1 to Table
| one | two |
|-----|-------|
| my | table |
| is | nice |
catmandu convert CSV to Table --fields id,name --columns ID,Name < sample.csv
| ID | Name |
|----|------|
| 23 | foo |
| 42 | bar |
| 99 | doz |
In Perl scripts π¦
use Catmandu::Exporter::Table;
my $exp = Catmandu::Exporter::Table->new;
$exp->add({ title => "The Hobbit", author => "Tolkien" });
$exp->add({ title => "Where the Wild Things Are", author => "Sendak" });
$exp->add({ title => "One Thousand and One Nights" });
$exp->commit;
| author | title |
|---------|-----------------------------|
| Tolkien | The Hobbit |
| Sendak | Where the Wild Things Are |
| | One Thousand and One Nights |
like. look at those little pipes. so clean. so aligned. it's giving spreadsheet but make it fashion π
πΈ DESCRIPTION πΈ
This Catmandu::Exporter exports your data in tabular form, formatted in MultiMarkdown syntax.
The output is perfect for a lil simple display moment β for instance, previewing Excel files right there on the command line. And if you wanna go further and convert to other table formats, like latex, html5, or mediawiki, you bring in Pandoc (http://johnmacfarlane.net/pandoc/) and let it cook:
catmandu convert XLS to Table < sheet.xls | pandoc -t html5
By default, columns are sorted alphabetically by field name. alphabetical. always. don't fight it. π€
π CONFIGURATION π
Table output can be controlled with the options fields, columns, widths, and condense β all as documented in Text::MarkdownTable.
file,fh,encoding,fixβ these are standard options ofCatmandu::Exporterπcondenseβ write the table in condense format with unaligned columns. (the chaotic option. respect it.)fieldsβ field names, as a comma-separated list or an array reference.columnsβ column names, as a comma-separated list or an array reference. By default the field names are used as the column names.headerβ include those header lines. Enabled by default. πwidthsβ column widths, as a comma-separated list or array references. Calculated from all rows by default. Heads up bestie: long cell values can get truncated with this option. πschemaβ supplyfieldsand (optionally)columnsin a JSON Table Schema (http://dataprotocols.org/json-table-schema/), either as a JSON file or as a hash reference, with the following structure:
{
"fields: [
{ "name": "field-name-1", "title": "column title 1 (optional)" },
{ "name": "field-name-2", "title": "column title 2 (optional)" },
...
]
}
ngl the "fields: [ line is missing its closing quote β that's literally how it's written in the original page, so I'm keeping it character for character. no cap. π
π METHODS π
See Catmandu::Exporter. That's the whole vibe check β it's all over there. β¨
π¦ SEE ALSO π¦
This module is based on Text::MarkdownTable. π
Similar Catmandu Exporters for tabular data include Catmandu::Exporter::CSV, Catmandu::Exporter::XLS, and Catmandu::Exporter::XLSX. the whole table girlie family, obsessed. π
and that's the page, bestie!! this manual is perl v5.36.0, dated 2023-02-11, and it was served up as Catman...::Table(3pm). go make a table, it'll eat, periodt π
β¨π
π¦ where this page comes from
- debian bookworm: libcatmandu-exporter-table-perl 0.3.0-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatmandu-exporter-table-perl 0.3.0-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatmandu-exporter-table-perl 0.3.0-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-exporter-table-perl 0.3.0-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-exporter-table-perl 0.3.0-3 Β· 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