MAN page from Old RedHat 6.X perl-HTML-Element-Extended-1.06-6.i386.rpm
lib::HTML::ElementTable
Section: User Contributed Perl Documentation (3)
Updated: perl 5.005, patch 03
Index NAME
HTML::ElementTable - Perl extension for manipulating a table composed of HTML::Element style components.
SYNOPSIS
use HTML::ElementTable; # Create a table 0..10 x 0..12 $t = new HTML::ElementTable maxrow => 10, maxcol => 12;
# Populate cells with coordinates $t->table->push_position;
# Manipulate <TABLE> tag $t->attr('cellspacing',0); $t->attr('border',1); $t->attr('bgcolor','#DDBB00'); # Manipulate entire table - optimize on <TR> or pass to all <TD> $t->table->attr('align','left'); $t->table->attr('valign','top'); # Manipulate rows (optimizes on <TR> if possible) $t->row(0,2,4,6)->attr('bgcolor','#9999FF'); # Manipulate columns (all go to <TD> tags within column) $t->col(0,4,8,12)->attr('bgcolor','#BBFFBB'); # Manipulate boxes (all go to <TD> elements # unless it contains full rows, then <TR>) $t->box(7,1 => 10,3)->attr('bgcolor','magenta'); $t->box(7,7 => 10,5)->attr('bgcolor','magenta'); $t->box(8,9 => 9,11)->attr('bgcolor','magenta'); $t->box(7,10 => 10,10)->attr('bgcolor','magenta'); # individual <TD> or <TH> attributes $t->cell(8,6)->attr('bgcolor','#FFAAAA'); $t->cell(9,6)->attr('bgcolor','#FFAAAA'); $t->cell(7,9, 10,9, 7,11, 10,11)->attr('bgcolor','#FFAAAA'); # Take a look print $t->as_HTML;
DESCRIPTION
HTML::ElementTable provides a highly enhanced HTML::ElementSuper structurewith methods designed to easily manipulate table elements byusing coordinates. Elements can be manipulated in bulk by individualcells, arbitrary groupings of cells, boxes, columns, rows, or theentire table.
PUBLIC METHODS
Table coordinates start at 0,0 in the upper left cell.
CONSTRUCTOR
- new()
- new(maxrow => row, maxcol => col)
- Return a new HTML::ElementTable object. If the number of rowsand columns were provided, all elements required for the rowsand columns will be initialized as well. See extent().
TABLE CONFIGURATION
- extent()
- extent(maxrow, maxcolumn)
- Set or return the extent of the current table. The maxrow andmaxcolumn parameters indicate the maximum row and column coordinatesyou desire in the table. These are the coordinates of the lowerright cell in the table, starting from (0,0) at the upper left. Providinga smaller extent than the current one will shrink the table with no ill effect, provided you do not mind losing the information in theclipped cells.
- maxrow()
- Set or return the coordinate of the last row.
- maxcol()
- Set or return the coordinate of the last column.
ELEMENT ACCESS
Unless accessing a single element, most table element access is accomplishedthrough globs, which are collections of elements that behave as if theywere a single element object.
Whenever possible, globbed operations are optimized into the most appropriateelement. For example, if you set an attribute for a row glob, the attributewill be set either on the <TR> element or the collected <TD> elements,whichever is appropriate.
See the HTML::ElementGlob(3) manpage for more information on element globs.
- cell(row,col,[row2,col2],[...])
- Access an individual cell or collection of cells by their coordinates.
- row(row,[row2,...])
- Access the contents of a row or collection of rows by row coordinate.
- col(col,[col2,...])
- Access the contents of a column or collection of columns by column coordinate.
- box(row_a1,col_a1,row_a2,col_a2,[row_b1,col_b1,row_b2,col_b2],[...])
- Access the contents of a span of cells, specified as a box consisting oftwo sets of coordinates. Multiple boxes can be specified.
- table()
- Access all cells in the table. This is different from manipulating thetable object itself, which is reserved for such things as CELLSPACINGand other attributes specific to the <TABLE> tag. However, since table()returns a glob of cells, if the attribute is more appropriate for thetop level <TABLE> tag, it will be placed there rather than in each<TR> tag or every <TD> tag.
ELEMENT/GLOB METHODS
The interfaces to a single table element or a glob of elements areidentical. All methods available from the HTML::ElementSuper classare also available to a table element or glob of elements.See the HTML::ElementSuper(3) manpage for details on these methods.
Briefly, here are some of the more useful methods provided by HTML::ElementSuper:
- attr()
- push_content()
- replace_content()
- wrap_content()
- clone([element])
- mask([mode])
TABLE SPECIFIC EXTENSIONS
- blank_fill([mode])
- Set or return the current fill mode for blank cells. The defaultis 0 for HTML::Element::Table elements. When most browsersrender tables, if they are empty you will get a box the colorof your browser background color rather than the BGCOLOR of thatcell. When enabled, empty cells are provided with an ` ',or invisible content, which will trigger the rendering of theBGCOLOR for that cell.
NOTES ON GLOBS
Globbing was a convenient way to treat arbitrary collections oftable cells as if they were a single HTML element. Methods aregenerally passed blindly and sequentially to the elements theycontain.
Most of the time, this is fairly intuitive, such as when you aresetting the attributes of the cells.
Other times, it might be problematic, such as with push_content().Do you push the same object to all of the cells? HTML::Element basedclasses only support one parent, so this breaks if you try to push thesame element into multiple parental hopefuls. In the specificcase of push_content() on globs, the elements that eventuallyget pushed are clones of the originally provided content. Itworks, but it is not necessarily what you expect. An incestuousHTML element tree is probably not what you want anyway.
See the HTML::ElementGlob(3) manpage for more details on how globs work.
REQUIRES
HTML::ElementSuper, HTML::ElementGlob
AUTHOR
Matthew P. Sisk, <
siskAATTmojotoad.com>
ACKNOWLEDGEMENTS
Thanks to William R. Ward for some conceptual nudging.
COPYRIGHT
Copyright (c) 1998-2000 Matthew P. Sisk.All rights reserved. All wrongs revenged. This program is freesoftware; you can redistribute it and/or modify it under thesame terms as Perl itself.
SEE ALSO
HTML::ElementSuper(3),
HTML::ElementGlob(3),
HTML::Element(3),
perl(1).
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- PUBLIC METHODS
- NOTES ON GLOBS
- REQUIRES
- AUTHOR
- ACKNOWLEDGEMENTS
- COPYRIGHT
- SEE ALSO
This document was created byman2html,using the manual pages.