1Text::SimpleTable(3) User Contributed Perl Documentation Text::SimpleTable(3)
2
3
4
6 Text::SimpleTable - Simple Eyecandy ASCII Tables
7
9 use Text::SimpleTable;
10
11 my $t1 = Text::SimpleTable->new(5, 10);
12 $t1->row('foobarbaz', 'yadayadayada');
13 print $t1->draw;
14
15 .-------+------------.
16 | foob- | yadayaday- |
17 | arbaz | ada |
18 '-------+------------'
19
20 my $t2 = Text::SimpleTable->new([5, 'Foo'], [10, 'Bar']);
21 $t2->row('foobarbaz', 'yadayadayada');
22 $t2->row('barbarbarbarbar', 'yada');
23 print $t2->draw;
24
25 .-------+------------.
26 | Foo | Bar |
27 +-------+------------+
28 | foob- | yadayaday- |
29 | arbaz | ada |
30 | barb- | yada |
31 | arba- | |
32 | rbar- | |
33 | bar | |
34 '-------+------------'
35
36 my $t3 = Text::SimpleTable->new([5, 'Foo'], [10, 'Bar']);
37 $t3->row('foobarbaz', 'yadayadayada');
38 $t3->hr;
39 $t3->row('barbarbarbarbar', 'yada');
40 print $t3->draw;
41
42 .-------+------------.
43 | Foo | Bar |
44 +-------+------------+
45 | foob- | yadayaday- |
46 | arbaz | ada |
47 +-------+------------+
48 | barb- | yada |
49 | arba- | |
50 | rbar- | |
51 | bar | |
52 '-------+------------'
53
54 print $t3->boxes->draw;
55
56 ┌───────┬────────────┐
57 │ Foo │ Bar │
58 ├───────┼────────────┤
59 │ foob- │ yadayaday- │
60 │ arbaz │ ada │
61 ├───────┼────────────┤
62 │ barb- │ yada │
63 │ arba- │ │
64 │ rbar- │ │
65 │ bar │ │
66 └───────┴────────────┘
67
69 Simple eyecandy ASCII tables.
70
72 Text::SimpleTable implements the following methods.
73
74 "new"
75 my $t = Text::SimpleTable->new(5, 10);
76 my $t = Text::SimpleTable->new([5, 'Col1', 10, 'Col2']);
77
78 "draw"
79 my $ascii = $t->draw;
80
81 "hr"
82 $t = $t->hr;
83
84 "row"
85 $t = $t->row('col1 data', 'col2 data');
86
87 "boxes"
88 $t = $t->boxes;
89
90 "boxes" switches the output generated by "draw" to use the unicode box
91 drawing characters. The last example above may not render nicely on
92 some devices.
93
95 Sebastian Riedel, "sri@cpan.org".
96
98 Marcus Ramberg "mramberg@cpan.org".
99
101 In alphabetical order:
102
103 Brian Cassidy
104
106 Copyright (C) 2005-2010, Sebastian Riedel.
107
108 This program is free software, you can redistribute it and/or modify it
109 under the terms of the Artistic License version 2.0.
110
111
112
113perl v5.28.0 2018-07-23 Text::SimpleTable(3)