NAME

Text::Table::Tiny

SYNOPSIS

use Text::Table::Tiny;
my $rows   = [
              ['Name', 'Rank', 'Serial'];
              ['alice', 'pvt', '123456'],
              ['bob',   'cpl', '98765321'],
              ['carol', 'brig gen', '8745']
             ];
# separate rows puts lines between rows, header_row says that the first row is headers
print Text::Table::Tiny::table(rows => $rows, separate_rows => 1, header_row => 1);

DESCRIPTION

Text::Table::Tiny provides a simple static method for building text tables for terminal scripts that require tablular rows.

METHODS

table
  my $table = Text::Table::Tiny::table( rows => $arrayref_of_arrayrefs );

creates a text table from an arrayref of arrayrefs.

options:
- header_row:    tells table() that the first row in $rows is a header row
- separate_rows: puts a separator line between rows, makes the header separator
                 line um... special.

So, the above example, called as:

  Text::Table::Tiny::table(rows => $rows);

would return:

  +-------+----------+----------+
  | Name  | Rank     | Serial   |
  | alice | pvt      | 123456   |
  | bob   | cpl      | 98765321 |
  | carol | brig gen | 8745     |
  +-------+----------+----------+

called with header_row:

  +-------+----------+----------+
  | Name  | Rank     | Serial   |
  +-------+----------+----------+
  | alice | pvt      | 123456   |
  | bob   | cpl      | 98765321 |
  | carol | brig gen | 8745     |
  +-------+----------+----------+

called with header_row and separate_rows would return:

  +-------+----------+----------+
  | Name  | Rank     | Serial   |
  O=======O==========O==========O
  | alice | pvt      | 123456   |
  +-------+----------+----------+
  | bob   | cpl      | 98765321 |
  +-------+----------+----------+
  | carol | brig gen | 8745     |
  +-------+----------+----------+

CLASS VARS

If you want to change the characters used for making the lines and separators, these are the class vars to use:

  $Text::Table::Tiny::COLUMN_SEPARATOR = '|';
  $Text::Table::Tiny::ROW_SEPARATOR = '-';
  $Text::Table::Tiny::CORNER_MARKER = '+';
  $Text::Table::Tiny::HEADER_ROW_SEPARATOR = '=';
  $Text::Table::Tiny::HEADER_CORNER_MARKER = 'O';

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 115:

'=item' outside of any '=over'

Around line 161:

You forgot a '=back' before '=head1'