A note about Text::Table::Manifold


Docs: Text::Table::Manifold.

Description

Outputs tables in any one of several supported types.

Features:

=item o Generic interface to all supported table formats

=item o Separately specify header/data/footer rows

=item o Separately include/exclude header/data/footer rows

=item o Align cell values

Each column has its own alignment option, left, center or right.

For internally generated HTML, this is done with a CSS div within each td, not with the obsolete td align attribute.

But decimal places are not alignable, yet, as discussed in the TODO.

=item o Escape HTML entities or URIs

But not both at the same time!

=item o Extend short header/data/footer rows with empty strings or undef

Auto-extension results in all rows being the same length.

This takes place before the transformation, if any, mentioned next.

=item o Tranform cell values which are empty strings and undef

=item o Pad cell values

=item o Handle UFT8

=item o Return the table as an arrayref of lines or as a string

The arrayref is returned by render([%hash]), and the string by render_as_string([%hash]).

When returning a string by calling render_as_string() (which calls render()), you can specify how the lines in the arrayref are joined.

In the same way the format parameter discussed just below controls the output, the join
parameter controls the join.

The format of the output is controlled by the format parameter to new(), or by the parameter to the format([$format]) method, or by the value of the format key in the hash passed to render([%hash]) and render_as_string(%hash]), and must be one of these imported constants:

=item o format_internal_boxed

All headers, footers and table data are surrounded by ASCII characters.

The rendering is done internally.

See scripts/internal.boxed.pl and output file data/internal.boxed.log.

=item o format_internal_github

Render as github-flavoured markdown.

The rendering is done internally.

See scripts/internal.github.pl and output file data/internal.github.log.

=item o format_internal_html

Render as a HTML table. You can use the pass_thru([$hashref]) method to set options for the HTML table.

The rendering is done internally.

See scripts/internal.html.pl and output file data/internal.html.log.

=item o format_html_table

Passes the data to HTML::Table. You can use the pass_thru([$hashref]) method to set options for the HTML::Table object constructor.

Warning: You must use Text::Table::Manifold's data() method, or the data parameter to
new(), and not the -data option to HTML::Table. This is because the module processes the data before calling the HTML::Table constructor.

=item o format_text_csv

Passes the data to Text::CSV. You can use the pass_thru([$hashref]) method to set options for the Text::CSV object constructor.

See scripts/text.csv.pl and output file data/text.csv.log.

=item o format_text_unicodebox_table

Passes the data to L. You can use the pass_thru([$hashref]) method to set options for the Text::UnicodeBox::Table object constructor.

See scripts/text.unicodebox.table.pl and output file data/text.unicodebox.table.log.

See also scripts/synopsis.pl, and the output data/synopsis.log.

Leave a comment

About Ron Savage

user-pic I try to write all code in Perl, but find I end up writing in bash, CSS, HTML, JS, and SQL, and doing database design, just to get anything done...