Simple eyecandy ascii tables
use Text::SimpleTable; my $t1 = Text::SimpleTable->new(5, 10); $t1->row('foobarbaz', 'yadayadayada'); print $t1->draw; .-------+------------. | foob- | yadayaday- | | arbaz | ada | '-------+------------' my $t2 = Text::SimpleTable->new([5, 'Foo'], [10, 'Bar']); $t2->row('foobarbaz', 'yadayadayada'); $t2->row('barbarbarbarbar', 'yada'); print $t2->draw; .-------+------------. | Foo | Bar | +-------+------------+ | foob- | yadayaday- | | arbaz | ada | | barb- | yada | | arba- | | | rbar- | | | bar | | '-------+------------' my $t3 = Text::SimpleTable->new([5, 'Foo'], [10, 'Bar']); $t3->row('foobarbaz', 'yadayadayada'); $t3->hr; $t3->row('barbarbarbarbar', 'yada'); print $t3->draw; .-------+------------. | Foo | Bar | +-------+------------+ | foob- | yadayaday- | | arbaz | ada | +-------+------------+ | barb- | yada | | arba- | | | rbar- | | | bar | | '-------+------------'
Simple eyecandy \s-1ASCII\s0 tables.
Text::SimpleTable implements the following methods. my $t = Text::SimpleTable->new(5, 10); my $t = Text::SimpleTable->new([5, 'Col1', 10, 'Col2']); my $ascii = $t->draw; $t = $t->hr; $t = $t->row('col1 data', 'col2 data');
Sebastian Riedel, \*(C`[email protected]\*(C'.
In alphabetical order:
Brian Cassidy
Copyright (C) 2005-2009, Sebastian Riedel.
This program is free software, you can redistribute it and/or modify it under the same terms as Perl 5.10.