HTML::Table - produces HTML tables
use HTML::Table; $table1 = new HTML::Table($rows, $cols); $table1->setCell($cellrow, $cellcol, "This is Cell 1"); $table1->setCellBGColor("blue"); $table1->setCellColSpan(1,1, 2); $table1->print; $table2 = new HTML::Table; $table2->addRow(@cell_values); $table2->addCol(@cell_values2); $table1->setCell(1,1, "$table2->getTable"); $table1->print;
Perl5.002
Nothing
HTML::Table is used to generate HTML tables for CGI scripts. By using the methods provided fairly complex tables can be created, manipulated, then printed from Perl scripts. The module also greatly simplifies creating tables within tables from Perl. It is possible to create an entire table using the methods provided and never use an HTML tag.
HTML::Table also allows for creating dynamically sized tables via its addRow and addCol methods. These methods automatically resize the table if passed more cell values than will fit in the current table grid.
Methods are provided for nearly all valid table, row, and cell tags specified for HTML 3.0.
[] indicate optional parameters. default value will be used if no value is specified
Creates a new HTML table object. If rows and columns are specified, the table will be initialized to that size. Row and Column numbers start at 1,1. 0,0 is considered and empty table.
Sets the table Border Width -- <BORDER> tag
Sets the table width -- <WIDTH> tag Remember to escape percent symbol if used
Adds a row to the bottom of the table. Assumes if you pass more values than there are columns that you want to increase the number of columns.
Adds a column to the right end of the table. Assumes if you pass more values than there are rows that you want to increase the number of rows.
Sets the content of a table cell. This could be any string, even another table object via the getTable method
Causes the cell to overlap a number of cells to the right. If the overlap number is greater than number of cells to the right of the cell, a false value will be returned.
Causes the cell to overlap a number of cells below it. If the overlap number is greater than number of cells below the cell, a false value will be returned.
Joins the block of cells with the corners specified. If the values specified are greater than the number of rows or columns, a false value will be returned.
Returns a string containing the HTML representation of the table.
Prints HTML representation of the table to STDOUT
Stacy Lacy, stacy-lacy@worldnet.att.net
perl(1), CGI(3)
To install HTML::Table, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Table
CPAN shell
perl -MCPAN -e shell install HTML::Table
For more information on module installation, please visit the detailed CPAN module installation guide.