1Text::SimpleTable::AutoUWsiedrthC(o3n)tributed Perl DocuTmeexntt:a:tSiiomnpleTable::AutoWidth(3)
2
3
4

NAME

6       Text::SimpleTable::AutoWidth - Text::SimpleTable::AutoWidth - Simple
7       eyecandy ASCII tables with auto-width selection
8

VERSION

10       version 0.09
11

SYNOPSIS

13           use Text::SimpleTable::AutoWidth;
14
15           my $t1 = Text::SimpleTable::AutoWidth->new();
16           $t1->row( 'foobarbaz', 'yadayadayada' );
17           print $t1->draw;
18
19           .-----------+--------------.
20           | foobarbaz | yadayadayada |
21           '-----------+--------------'
22
23
24           my $t2 = Text::SimpleTable::AutoWidth->new();
25           $t2->captions( 'Foo', 'Bar' );
26           $t2->row( 'foobarbaz', 'yadayadayada' );
27           $t2->row( 'barbarbarbarbar', 'yada' );
28           print $t2->draw;
29
30           .-----------------+--------------.
31           | Foo             | Bar          |
32           +-----------------+--------------+
33           | foobarbaz       | yadayadayada |
34           | barbarbarbarbar | yada         |
35           '-----------------+--------------'
36

DESCRIPTION

38       Simple eyecandy ASCII tables with auto-selection columns width, as seen
39       in Catalyst.
40

METHODS

42   new(@attrs)
43       Inherited constructor from Moo.  You can set following attributes:
44
45       fixed_width
46
47       Set fixed width for resulting table. By default it's 0, that's mean
48       "don't fix width", so width of result table will depend on input data.
49
50       Be warned, that fixed_width will include not only width of your data,
51       but also all surronding characters, like spaces across values, table
52       drawings (like '|') and hypen (if wrapping is needed).
53
54       max_width
55
56       Set maximum width for resulting table. By default it's 0, that's mean
57       "use default value". Default value is stored in
58       $Text::SimpleTable::AutoWidth::WIDTH_LIMIT, and can be changed at any
59       moment. Default value for WIDTH_LIMIT is 200.
60
61       Be warned, that max_width will include not only width of your data, but
62       also all surronding characters, like spaces across values, table
63       drawings (like '|') and hypen (if wrapping is needed).
64
65       NB: if you set fixed_width and max_width at same time, then you'll get
66       table with fixed width, but not wider than max_width characters.
67
68       captions
69
70       ArrayRef[Str] for captions in resulting table.
71
72       rows
73
74       ArrayRef[ArrayRef[Str]] for values in each row.  You can use next
75       method to add individual rows into table.
76
77   row(@texts)
78       Add new row to table. Return $self, so you can write something like
79       this:
80
81           print Text::SimpleTable::AutoWidth
82               ->new( max_width => 55, captions => [qw/ Name Age /] )
83               ->row( 'Mother', 59 )
84               ->row( 'Dad', 58 )
85               ->row( 'me', 32 )
86               ->draw();
87
88   draw()
89       Draw table. Really, just calculate column width, and then call
90       Text::SimpleTable->draw().
91

GIT REPOSITORY

93       git clone git://github.com/cub-uanic/Text-SimpleTable-AutoWidth.git
94

SEE ALSO

96       Text::SimpleTable, Moo, Catalyst
97

AUTHOR

99       Oleg Kostyuk, "<cub#cpan.org>"
100
102       Copyright by Oleg Kostyuk.
103
104       This program is free software; you can redistribute it and/or modify it
105       under the terms of either: the GNU General Public License as published
106       by the Free Software Foundation; or the Artistic License.
107
108       See http://dev.perl.org/licenses/ for more information.
109

AUTHOR

111       Oleg Kostyuk <cub.uanic@gmail.com>
112
114       This software is copyright (c) 2015 by Oleg Kostyuk.
115
116       This is free software; you can redistribute it and/or modify it under
117       the same terms as the Perl 5 programming language system itself.
118
119
120
121perl v5.32.0                      2020-07-28   Text::SimpleTable::AutoWidth(3)
Impressum