NAME

Term::Table - Format a header and rows into a table

DESCRIPTION

This is used by some failing tests to provide diagnostics about what has gone wrong. This module is able to generic format rows of data into tables.

SYNOPSIS

use Term::Table;

my $table = Term::Table->new(
    max_width    => 80, # defaults to terminal size 
    collapse     => 1, # do not show empty columns
    header => [ 'name', 'age', 'hair color' ],
    rows         => [
        [ 'Fred Flinstone',  2000000, 'black' ],
        [ 'Wilma Flinstone', 1999995, 'red' ],
        ...
    ],
);

say $_ for $table->render;

This prints a table like this:

+-----------------+---------+------------+
| name            | age     | hair color |
+-----------------+---------+------------+
| Fred Flinstone  | 2000000 | black      |
| Wilma Flinstone | 1999995 | red        |
| ...             | ...     | ...        |
+-----------------+---------+------------+

INTERFACE

use Term::Table;
my $table = Term::Table->new(...);

OPTIONS

NOTE ON UNICODE/WIDE CHARACTERS

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 anomalies in the table:

+-----+-----+---+
| a   | b   | c |
+-----+-----+---+
| 婧 | x   | y |
| x   | y   | z |
| x   | 婧 | z |
+-----+-----+---+

SOURCE

The source code repository for Term-Table can be found at http://github.com/exodist/Term-Table/.

MAINTAINERS

AUTHORS

COPYRIGHT

Copyright 2016 Chad Granum exodist@cpan.org.

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/