.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Text::ASCIITable 3pm" .TH Text::ASCIITable 3pm "2016-12-29" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Text::ASCIITable \- Create a nice formatted table using ASCII characters. .SH "SHORT DESCRIPTION" .IX Header "SHORT DESCRIPTION" Pretty nifty if you want to output dynamic text to your console or other fixed-size-font displays, and at the same time it will display it in a nice human-readable, or \*(L"cool\*(R" way. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Text::ASCIITable; \& $t = Text::ASCIITable\->new({ headingText => \*(AqBasket\*(Aq }); \& \& $t\->setCols(\*(AqId\*(Aq,\*(AqName\*(Aq,\*(AqPrice\*(Aq); \& $t\->addRow(1,\*(AqDummy product 1\*(Aq,24.4); \& $t\->addRow(2,\*(AqDummy product 2\*(Aq,21.2); \& $t\->addRow(3,\*(AqDummy product 3\*(Aq,12.3); \& $t\->addRowLine(); \& $t\->addRow(\*(Aq\*(Aq,\*(AqTotal\*(Aq,57.9); \& print $t; \& \& # Result: \& .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. \& | Basket | \& +\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+ \& | Id | Name | Price | \& +\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+ \& | 1 | Dummy product 1 | 24.4 | \& | 2 | Dummy product 2 | 21.2 | \& | 3 | Dummy product 3 | 12.3 | \& +\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+ \& | | Total | 57.9 | \& \*(Aq\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\*(Aq .Ve .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "new(options)" .IX Subsection "new(options)" Initialize a new table. You can specify output-options. For more options, check out the usage for \fIsetOptions()\fR .PP .Vb 2 \& Usage: \& $t = Text::ASCIITable\->new(); \& \& Or with options: \& $t = Text::ASCIITable\->new({ hide_Lastline => 1, reportErrors => 0}); .Ve .SS "setCols(@cols)" .IX Subsection "setCols(@cols)" Define the columns for the table(compare with <\s-1TH\s0> in \s-1HTML\s0). For example \f(CW\*(C`setCols([\*(AqId\*(Aq,\*(AqNick\*(Aq,\*(AqName\*(Aq])\*(C'\fR. \&\fBNote\fR that you cannot add Cols after you have added a row. Multiline columnnames are allowed. .SS "addRow(@collist)" .IX Subsection "addRow(@collist)" Adds one row to the table. This must be an array of strings. If you defined 3 columns. This array must have 3 items in it. And so on. Should be self explanatory. The strings can contain newlines. .PP .Vb 2 \& Note: It does not require argument to be an array, thus; \& $t\->addRow([\*(Aqid\*(Aq,\*(Aqname\*(Aq]) and $t\->addRow(\*(Aqid\*(Aq,\*(Aqname\*(Aq) does the same thing. .Ve .PP This module is also overloaded to accept push. To construct a table with the use of overloading you might do the following: .PP .Vb 4 \& $t = Text::ASCIITable\->new(); \& $t\->setCols(\*(Aqone\*(Aq,\*(Aqtwo\*(Aq,\*(Aqthree\*(Aq,\*(Aqfour\*(Aq); \& push @$t, ( "one\entwo" ) x 4; # Replaces $t\->addrow(); \& print $t; # Replaces print $t\->draw(); \& \& Which would construct: \& .\-\-\-\-\-+\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-. \& | one | two | three | four | \& |=\-\-\-\-+\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-=| \& | one | one | one | one | # Note that theese two lines \& | two | two | two | two | # with text are one singe row. \& \*(Aq\-\-\-\-\-+\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\*(Aq .Ve .PP There is also possible to give this function an array of arrayrefs and hence support the output from DBI::selectall_arrayref($sql) without changes. .PP .Vb 6 \& Example of multiple\-rows pushing: \& $t\->addRow([ \& [ 1, 2, 3 ], \& [ 4, 5, 6 ], \& [ 7, 8, 9 ], \& ]); .Ve .SS "addRowLine([$row])" .IX Subsection "addRowLine([$row])" Will add a line after the current row. As an argument, you may specify after which row you want a line (first row is 1) or an array of row numbers. (\s-1HINT:\s0 If you want a line after every row, read about the drawRowLine option in \fIsetOptions()\fR) .PP Example without arguments: \f(CW$t\fR\->addRow('one','two','three'); \f(CW$t\fR\->\fIaddRowLine()\fR; \f(CW$t\fR\->addRow('one','two','three'); .PP Example with argument: \f(CW$t\fR\->addRow('one','two','three'); \f(CW$t\fR\->addRow('one','two','three'); \f(CW$t\fR\->addRow('one','two','three'); \f(CW$t\fR\->addRow('one','two','three'); \f(CW$t\fR\->\fIaddRowLine\fR\|(1); # or multiple: \f(CW$t\fR\->addRowLine([2,3]); .SS "alignCol($col,$direction) or alignCol({col1 => direction1, col2 => direction2, ... })" .IX Subsection "alignCol($col,$direction) or alignCol({col1 => direction1, col2 => direction2, ... })" Given a columnname, it aligns all data to the given direction in the table. This looks nice on numerical displays in a column. The column names in the table will be unaffected by the alignment. Possible directions is: left, center, right, justify, auto or your own subroutine. (Hint: Using auto(default), aligns numbers right and text left) .SS "alignColName($col,$direction)" .IX Subsection "alignColName($col,$direction)" Given a columnname, it aligns the columnname in the row explaining columnnames, to the given direction. (auto,left,right,center,justify or a subroutine) (Hint: Overrides the 'alignHeadRow' option for the specified column.) .SS "setColWidth($col,$width,$strict)" .IX Subsection "setColWidth($col,$width,$strict)" Wordwrapping/strict size. Set a max\-width(in chars) for a column. If last parameter is 1, the column will be set to the specified width, even if no text is that long. .PP .Vb 2 \& Usage: \& $t\->setColWidth(\*(AqDescription\*(Aq,30); .Ve .SS "\fIgetTableWidth()\fP" .IX Subsection "getTableWidth()" If you need to know how wide your table will be before you draw it. Use this function. .SS "setOptions(name,value) or setOptions({ option1 => value1, option2 => value2, ... })" .IX Subsection "setOptions(name,value) or setOptions({ option1 => value1, option2 => value2, ... })" Use this to set options like: hide_FirstLine,reportErrors, etc. .PP .Vb 2 \& Usage: \& $t\->setOptions(\*(Aqhide_HeadLine\*(Aq,1); \& \& Or set more than one option on the fly: \& $t\->setOptions({ hide_HeadLine => 1, hide_HeadRow => 1 }); .Ve .PP \&\fBPossible Options\fR .IP "hide_HeadRow" 4 .IX Item "hide_HeadRow" Hides output of the columnlisting. Together with hide_HeadLine, this makes a table only show the rows. (However, even though the column-names will not be shown, they will affect the output if they have for example ridiculoustly long names, and the rows contains small amount of info. You would end up with a lot of whitespace) .IP "reportErrors" 4 .IX Item "reportErrors" Set to 0 to disable error reporting. Though if a function encounters an error, it will still return the value 1, to tell you that things didn't go exactly as they should. .IP "allowHTML" 4 .IX Item "allowHTML" If you are going to use Text::ASCIITable to be shown on \s-1HTML\s0 pages, you should set this option to 1 when you are going to use \s-1HTML\s0 tags to for example color the text inside the rows, and you want the browser to handle the table correct. .IP "allowANSI" 4 .IX Item "allowANSI" If you use \s-1ANSI\s0 codes like <\s-1ESC\s0>[1mHi this is bold<\s-1ESC\s0>[m or similar. This option will make the table to be displayed correct when showed in a \s-1ANSI\s0 compliant terminal. Set this to 1 to enable. There is an example of \s-1ANSI\s0 support in this package, named ansi\-example.pl. .IP "alignHeadRow" 4 .IX Item "alignHeadRow" Set which direction the Column\-names(in the headrow) are supposed to point. Must be left, right, center, justify, auto or a user-defined subroutine. .IP "hide_FirstLine, hide_HeadLine, hide_LastLine" 4 .IX Item "hide_FirstLine, hide_HeadLine, hide_LastLine" Speaks for it self? .IP "drawRowLine" 4 .IX Item "drawRowLine" Set this to 1 to print a line between each row. You can also define the outputstyle of this line in the \fIdraw()\fR function. .IP "headingText" 4 .IX Item "headingText" Add a heading above the columnnames/rows which uses the whole width of the table to output a heading/title to the table. The heading-part of the table is automatically shown when the headingText option contains text. \fBNote:\fR If this text is so long that it makes the table wider, it will not hesitate to change width of columns that have \*(L"strict width\*(R". .Sp It supports multiline, and with Text::ASCIITable::Wrap you may wrap your text before entering it, to prevent the title from expanding the table. Internal wrapping-support for headingText might come in the future. .IP "headingAlign" 4 .IX Item "headingAlign" Align the heading(as mentioned above) to left, right, center, auto or using a subroutine. .IP "headingStartChar, headingStopChar" 4 .IX Item "headingStartChar, headingStopChar" Choose the startingchar and endingchar of the row where the title is. The default is \&'|' on both. If you didn't understand this, try reading about the \fIdraw()\fR function. .IP "cb_count" 4 .IX Item "cb_count" Set the callback subroutine to use when counting characters inside the table. This is useful to make support for having characters or codes inside the table that are not shown on the screen to the user, so the table should not count these characters. This could be for example \&\s-1HTML\s0 tags, or \s-1ANSI\s0 codes. Though those two examples are alredy supported internally with the allowHTML and allowANSI, options. This option expects a \s-1CODE\s0 reference. (\e&callback_function) .IP "undef_as" 4 .IX Item "undef_as" Sets the replacing string that replaces an undef value sent to \fIaddRow()\fR (or even the overloaded push version of \fIaddRow()\fR). The default value is an empty string ''. An example of use would be to set it to '(undef)', to show that the input really was undefined. .IP "chaining" 4 .IX Item "chaining" Set this to 1 to support chainging of methods. The default is 0, where the methods return 1 if they come upon an error as mentioned in the reportErrors option description. .Sp .Vb 9 \& Usage example: \& print Text::ASCIITable\->new({ chaining => 1 }) \& \->setCols(\*(AqOne\*(Aq,\*(AqTwo\*(Aq,\*(AqThree\*(Aq) \& \->addRow([ \& [ 1, 2, 3 ], \& [ 4, 5, 6 ], \& [ 7, 8, 9 ], \& ]) \& \->draw(); .Ve .Sp Note that \->\fIdraw()\fR can be omitted, since Text::ASCIITable is overloaded to print the table by default. .SS "draw([@topdesign,@toprow,@middle,@middlerow,@bottom,@rowline])" .IX Subsection "draw([@topdesign,@toprow,@middle,@middlerow,@bottom,@rowline])" All the arrays containing the layout is optional. If you want to make your own \*(L"design\*(R" to the table, you can do that by giving this method these arrays containing information about which characters to use where. .PP \&\fBCustom tables\fR .PP The draw method takes \f(CW6\fR arrays of strings to define the layout. The first, third, fifth and sixth is \fB\s-1LINE\s0\fR layout and the second and fourth is \fB\s-1ROW\s0\fR layout. The \f(CW\*(C`fourth\*(C'\fR parameter is repeated for each row in the table. The sixth parameter is only used if drawRowLine is enabled. .PP .Vb 1 \& $t\->draw(,,,,,[]) .Ve .IP "\s-1LINE\s0" 4 .IX Item "LINE" Takes an array of \f(CW4\fR strings. For example \f(CW\*(C`[\*(Aq|\*(Aq,\*(Aq|\*(Aq,\*(Aq\-\*(Aq,\*(Aq+\*(Aq]\*(C'\fR .RS 4 .IP "\(bu" 4 \&\s-1LEFT \-\s0 Defines the left chars. May be more than one char. .IP "\(bu" 4 \&\s-1RIGHT \-\s0 Defines the right chars. May be more then one char. .IP "\(bu" 4 \&\s-1LINE \-\s0 Defines the char used for the line. \fBMust be only one char\fR. .IP "\(bu" 4 \&\s-1DELIMETER \-\s0 Defines the char used for the delimiters. \fBMust be only one char\fR. .RE .RS 4 .RE .IP "\s-1ROW\s0" 4 .IX Item "ROW" Takes an array of \f(CW3\fR strings. You should not give more than one char to any of these parameters, if you do.. it will probably destroy the output.. Unless you do it with the knowledge of how it will end up. An example: \f(CW\*(C`[\*(Aq|\*(Aq,\*(Aq|\*(Aq,\*(Aq+\*(Aq]\*(C'\fR .RS 4 .IP "\(bu" 4 \&\s-1LEFT \-\s0 Define the char used for the left side of the table. .IP "\(bu" 4 \&\s-1RIGHT \-\s0 Define the char used for the right side of the table. .IP "\(bu" 4 \&\s-1DELIMETER \-\s0 Defines the char used for the delimiters. .RE .RS 4 .RE .PP Examples: .PP The easiest way: .PP .Vb 1 \& print $t; .Ve .PP Explanatory example: .PP .Vb 6 \& print $t\->draw( [\*(AqL\*(Aq,\*(AqR\*(Aq,\*(Aql\*(Aq,\*(AqD\*(Aq], # LllllllDllllllR \& [\*(AqL\*(Aq,\*(AqR\*(Aq,\*(AqD\*(Aq], # L info D info R \& [\*(AqL\*(Aq,\*(AqR\*(Aq,\*(Aql\*(Aq,\*(AqD\*(Aq], # LllllllDllllllR \& [\*(AqL\*(Aq,\*(AqR\*(Aq,\*(AqD\*(Aq], # L info D info R \& [\*(AqL\*(Aq,\*(AqR\*(Aq,\*(Aql\*(Aq,\*(AqD\*(Aq] # LllllllDllllllR \& ); .Ve .PP Nice example: .PP .Vb 6 \& print $t\->draw( [\*(Aq.\*(Aq,\*(Aq.\*(Aq,\*(Aq\-\*(Aq,\*(Aq\-\*(Aq], # .\-\-\-\-\-\-\-\-\-\-\-\-\-. \& [\*(Aq|\*(Aq,\*(Aq|\*(Aq,\*(Aq|\*(Aq], # | info | info | \& [\*(Aq|\*(Aq,\*(Aq|\*(Aq,\*(Aq\-\*(Aq,\*(Aq\-\*(Aq], # |\-\-\-\-\-\-\-\-\-\-\-\-\-| \& [\*(Aq|\*(Aq,\*(Aq|\*(Aq,\*(Aq|\*(Aq], # | info | info | \& [\*(Aq \e\e\*(Aq,\*(Aq/ \*(Aq,\*(Aq_\*(Aq,\*(Aq|\*(Aq] # \e_\|_\|_\|_\|_|_\|_\|_\|_\|_/ \& ); .Ve .PP Nice example2: .PP .Vb 6 \& print $t\->draw( [\*(Aq.=\*(Aq,\*(Aq=.\*(Aq,\*(Aq\-\*(Aq,\*(Aq\-\*(Aq], # .=\-\-\-\-\-\-\-\-\-\-\-=. \& [\*(Aq|\*(Aq,\*(Aq|\*(Aq,\*(Aq|\*(Aq], # | info | info | \& [\*(Aq|=\*(Aq,\*(Aq=|\*(Aq,\*(Aq\-\*(Aq,\*(Aq+\*(Aq], # |=\-\-\-\-\-+\-\-\-\-\-=| \& [\*(Aq|\*(Aq,\*(Aq|\*(Aq,\*(Aq|\*(Aq], # | info | info | \& ["\*(Aq=","=\*(Aq",\*(Aq\-\*(Aq,\*(Aq\-\*(Aq] # \*(Aq=\-\-\-\-\-\-\-\-\-\-\-=\*(Aq \& ); .Ve .PP With Options: .PP .Vb 10 \& $t\->setOptions(\*(AqdrawRowLine\*(Aq,1); \& print $t\->draw( [\*(Aq.=\*(Aq,\*(Aq=.\*(Aq,\*(Aq\-\*(Aq,\*(Aq\-\*(Aq], # .=\-\-\-\-\-\-\-\-\-\-\-=. \& [\*(Aq|\*(Aq,\*(Aq|\*(Aq,\*(Aq|\*(Aq], # | info | info | \& [\*(Aq|\-\*(Aq,\*(Aq\-|\*(Aq,\*(Aq=\*(Aq,\*(Aq=\*(Aq], # |\-===========\-| \& [\*(Aq|\*(Aq,\*(Aq|\*(Aq,\*(Aq|\*(Aq], # | info | info | \& ["\*(Aq=","=\*(Aq",\*(Aq\-\*(Aq,\*(Aq\-\*(Aq], # \*(Aq=\-\-\-\-\-\-\-\-\-\-\-=\*(Aq \& [\*(Aq|=\*(Aq,\*(Aq=|\*(Aq,\*(Aq\-\*(Aq,\*(Aq+\*(Aq] # rowseperator \& ); \& Which makes this output: \& .=\-\-\-\-\-\-\-\-\-\-\-=. \& | col1 | col2 | \& |\-===========\-| \& | info | info | \& |=\-\-\-\-\-+\-\-\-\-\-=| <\-\- rowseperator between each row \& | info | info | \& \*(Aq=\-\-\-\-\-\-\-\-\-\-\-=\*(Aq .Ve .PP A tips is to enable allowANSI, and use the extra charset in your terminal to create a beautiful table. But don't expect to get good results if you use ANSI-formatted table with \f(CW$t\fR\->drawPage. .PP \&\fBUser-defined subroutines for aligning\fR .PP If you want to format your text more throughoutly than \*(L"auto\*(R", or think you have a better way of aligning text; you can make your own subroutine. .PP .Vb 1 \& Here\*(Aqs a exampleroutine that aligns the text to the right. \& \& sub myownalign_cb { \& my ($text,$length,$count,$strict) = @_; \& $text = (" " x ($length \- $count)) . $text; \& return substr($text,0,$length) if ($strict); \& return $text; \& } \& \& $t\->alignCol(\*(AqInfo\*(Aq,\e&myownalign_cb); .Ve .PP \&\fBUser-defined subroutines for counting\fR .PP This is a feature to use if you are not happy with the internal allowHTML or allowANSI support. Given is an example of how you make a count-callback that makes ASCIITable support \&\s-1ANSI\s0 codes inside the table. (would make the same result as setting allowANSI to 1) .PP .Vb 6 \& $t\->setOptions(\*(Aqcb_count\*(Aq,\e&myallowansi_cb); \& sub myallowansi_cb { \& $_=shift; \& s/\e33\e[(\ed+(;\ed+)?)?[musfwhojBCDHRJK]//g; \& return length($_); \& } .Ve .SS "drawPage($page,@topdesign,@toprow,@middle,@middlerow,@bottom,@rowline)" .IX Subsection "drawPage($page,@topdesign,@toprow,@middle,@middlerow,@bottom,@rowline)" If you don't want your table to be wider than your screen you can use this with \f(CW$t\fR\->setOptions('outputWidth',40) to set the max size of the output. .PP Example: .PP .Vb 5 \& $t\->setOptions(\*(AqoutputWidth\*(Aq,80); \& for my $page (1..$t\->pageCount()) { \& print $t\->drawPage($page)."\en"; \& print "continued..\en\en"; \& } .Ve .SH "FEATURES" .IX Header "FEATURES" In case you need to know if this module has what you need, I have made this list of features included in Text::ASCIITable. .IP "Configurable layout" 4 .IX Item "Configurable layout" You can easily alter how the table should look, in many ways. There are a few examples in the \fIdraw()\fR section of this documentation. And you can remove parts of the layout or even add a heading-part to the table. .IP "Text Aligning" 4 .IX Item "Text Aligning" Align the text in a column auto(matically), left, right, center or justify. Usually you want to align text to right if you only have numbers in that row. The 'auto' direction aligns text to left, and numbers to the right. The 'justify' alignment evens out your text on each line, so the first and the last word always are at the beginning and the end of the current line. This gives you the newspaper paragraph look. You can also use your own subroutine as a callback-function to align your text. .IP "Multiline support in rows" 4 .IX Item "Multiline support in rows" With the \en(ewline) character you can have rows use more than just one line on the output. (This looks nice with the drawRowLine option enabled) .IP "Wordwrap support" 4 .IX Item "Wordwrap support" You can set a column to not be wider than a set amount of characters. If a line exceedes for example 30 characters, the line will be broken up in several lines. .IP "\s-1HTML\s0 support" 4 .IX Item "HTML support" If you put in <\s-1HTML\s0> tags inside the rows, the output would usually be broken when viewed in a browser, since the browser \*(L"execute\*(R" the tags instead of displaying it. But if you enable allowHTML. You are able to write html tags inside the rows without the output being broken if you display it in a browser. But you should not mix this with wordwrap, since this could make undesirable results. .IP "\s-1ANSI\s0 support" 4 .IX Item "ANSI support" Allows you to decorate your tables with colors or bold/underline when you display your tables to a terminal window. .IP "Page-flipping support" 4 .IX Item "Page-flipping support" If you don't want the table to get wider than your terminal-width. .IP "Errorreporting" 4 .IX Item "Errorreporting" If you write a script in perl, and don't want users to be notified of the errormessages from Text::ASCIITable. You can easily turn of error reporting by setting reportErrors to 0. You will still get an 1 instead of undef returned from the function. .SH "REQUIRES" .IX Header "REQUIRES" Exporter, Carp .SH "AUTHOR" .IX Header "AUTHOR" Ha\*okon Nessjo\*/en, .SH "VERSION" .IX Header "VERSION" Current version is 0.22. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2002\-2011 by Ha\*okon Nessjo\*/en. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Text::FormatTable, Text::Table, Text::SimpleTable