NAME

Text::Table::Tiny - makes simple tables from two-dimensional arrays, with limited templating options

VERSION

version 0.03

OPTIONS

  • header_row

    true/false, designate first row in $rows as a header row and separate with a line

  • separate_rows

    true/false put a separator line between rows and use a thicker line for header separator

SYNOPSIS

  use Text::Table::Tiny;
  my $rows = [
      # header row
      ['Name', 'Rank', 'Serial'],
      # rows
      ['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);

Example in the synopsis: Text::Table::Tiny::table(rows => $rows);

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

with header_row: Text::Table::Tiny::table(rows => $rows, header_row => 1);

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

with header_row and separate_rows: Text::Table::Tiny::table(rows => $rows, header_row => 1, separate_rows => 1);

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

FORMAT VARIABLES

  • $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';

AUTHOR

Creighton Higgins <chiggins@chiggins.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Creighton Higgins.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.