|
NAMEHTML::ElementTable - Perl extension for manipulating a table composed of HTML::Element style components.SYNOPSISuse 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; DESCRIPTIONHTML::ElementTable provides a highly enhanced HTML::ElementSuper structure with methods designed to easily manipulate table elements by using coordinates. Elements can be manipulated in bulk by individual cells, arbitrary groupings of cells, boxes, columns, rows, or the entire table.PUBLIC METHODSTable coordinates start at 0,0 in the upper left cell.CONSTRUCTORS
TABLE CONFIGURATION
ELEMENT ACCESS Unless accessing a single element, most table element access is accomplished through globs, which are collections of elements that behave as if they were a single element object. Whenever possible, globbed operations are optimized into the most appropriate element. For example, if you set an attribute for a row glob, the attribute will be set either on the <TR> element or the collected <TD> elements, whichever is appropriate. See HTML::ElementGlob(3) for more information on element globs.
ELEMENT/GLOB METHODS The interfaces to a single table element or a glob of elements are identical. All methods available from the HTML::ElementSuper class are also available to a table element or glob of elements. See HTML::ElementSuper(3) for details on these methods. Briefly, here are some of the more useful methods provided by HTML::ElementSuper:
TABLE SPECIFIC EXTENSIONS
NOTES ON GLOBSGlobbing was a convenient way to treat arbitrary collections of table cells as if they were a single HTML element. Methods are generally passed blindly and sequentially to the elements they contain.Most of the time, this is fairly intuitive, such as when you are setting 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 based classes only support one parent, so this breaks if you try to push the same element into multiple parental hopefuls. In the specific case of push_content() on globs, the elements that eventually get pushed are clones of the originally provided content. It works, but it is not necessarily what you expect. An incestuous HTML element tree is probably not what you want anyway. See HTML::ElementGlob(3) for more details on how globs work. REQUIRESHTML::ElementSuper, HTML::ElementGlobAUTHORMatthew P. Sisk, <sisk@mojotoad.com>ACKNOWLEDGEMENTSThanks to William R. Ward for some conceptual nudging.COPYRIGHTCopyright (c) 1998-2010 Matthew P. Sisk. All rights reserved. All wrongs revenged. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.SEE ALSOA useful page of HTML::ElementTable examples can be found at http://www.mojotoad.com/sisk/projects/HTML-Element-Extended/examples.html.HTML::ElementSuper(3), HTML::ElementGlob(3), HTML::Element(3), HTML::TableExtract(3), perl(1).
Visit the GSP FreeBSD Man Page Interface. |