Text::UnicodeTable::Simple - Create a formatted table using characters.
use Text::UnicodeTable::Simple; $t = Text::UnicodeTable::Simple->new(); $t->set_header(qw/Subject Score/); $t->add_row('English', '78'); $t->add_row('Mathematics', '91'); $t->add_row('Chemistry', '64'); $t->add_row('Physics', '95'); $t->add_row_line(); $t->add_row('Total', '328'); print "$t"; # Result: .-------------+-------. | Subject | Score | +-------------+-------+ | English | 78 | | Mathematics | 91 | | Chemistry | 64 | | Physics | 95 | +-------------+-------+ | Total | 328 | '-------------+-------'
Text::UnicodeTable::Simple creates character table.
There are some modules for creating a text table at CPAN, Text::ASCIITable, Text::SimpleTable, Text::Table etc. But those module deal with only ASCII, don't deal with full width characters. If you use them with full width characters, a table created may be bad-looking.
Text::UnicodeTable::Simple resolves problem of full width characters. So you can use Japansese Hiragana, Katakana, Korean Hangeul, Chinese Kanji characters. See eg/ directory for examples.
eg/
Creates and returns a new table instance with %args.
%args might be
Table header. If you set table header with constructor, you can omit set_header method.
set_header
Table has no border if border is False.
border
Ignore ANSI color escape sequence
Alignment for each columns. Every columns are aligned by this if you specify this parameter.
Set the headers for the table. (compare with <th> in HTML). You must call set_header firstly. If you call other methods without calling set_header, then you fail.
Input strings should be string, not octet stream.
Add one row to the table.
Add rows to the table. You can add row at one time. Each @collists element should be ArrayRef.
@collists
Add a line after the current row. If 'border' parameter is false, add a new line.
Return the table as string.
Text::UnicodeTable::Simple overload stringify operator, so you can omit ->draw() method.
->draw()
Syohei YOSHIDA <syohex@gmail.com>
Copyright 2011- Syohei YOSHIDA
Text::ASCIITable
Text::SimpleTable
Text::Table
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Text::UnicodeTable::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::UnicodeTable::Simple
CPAN shell
perl -MCPAN -e shell install Text::UnicodeTable::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.