Apache::Wyrd::Lattice - Generate HTML Tables from Tabular Data
<BASENAME::Lattice> <BASENAME::Query> <BASENAME::CGISetter style="sql"> select name, email from contact_database where name=$:name </BASENAME::CGISetter> </BASENAME::Query> <BASENAME::Lattice::Header> <table class="ctable"> <tr><th>Name</th><th>E-Mail</th></tr> </BASENAME::Lattice::Header> <BASENAME::Lattice::Grid> <tr bgcolor="#CCCCCC"> <td class="namecol">$:name</td> <td class="emailcol"><a href="mailto:$:email">$:email</a></td> </tr></BASENAME::Lattice::Grid> <BASENAME::Lattice::Footer></table></BASENAME::Lattice::Footer> </BASENAME::Lattice>
The Lattice Wyrd represents the result of an Apache::Wyrd::Query Wyrd in HTML. Three supporting Wyrds, Apache::Wyrd::Lattice::Header, Apache::Wyrd::Lattice::Grid, Apache::Wyrd::Lattice::Footer give the HTML a beginning, a repeated middle, and an end.
Apache::Wyrd::Query
Apache::Wyrd::Lattice::Header
Apache::Wyrd::Lattice::Grid
Apache::Wyrd::Lattice::Footer
Unless provided within the Lattice Wyrd, as in the SYNOPSIS, the Lattice Wyrd defaults to a simple HTML table. The cols attribute is parsed (whitespace/comma) to determine these columns. If no cols attribute is given, the Grid Wyrd is scanned for placemarkers in the Apache::Wyrd::Interfaces::Setter style. Lastly, if no Grid Wyrd is given, Lattice will attempt to create a Grid based on the columns returned by the Query. The data will appear in this grid, one column per table column.
Apache::Wyrd::Interfaces::Setter
Which columns of the query to display.
(format: (returns) name (arguments after self))
_format_table
_format_tr
_format_th
_format_td
When the Lattice Wyrd is used in default mode, it is very simple to define a default "house style" by implementing the _format_xxx methods for tables, rows, headers, and cells.
_format_xxx
Reserves the _setup and _generate_output methods. Also reserves the register_header, register_grid, register_footer, and register_query methods for the respective sub-Wyrds. "Automatic" formatting is provided by the private methods _auto_encapsulate, _auto_header, _auto_grid, _aouto_footer, and _cols_from_grid.
Barry King <wyrd@nospam.wyrdwright.com>
General-purpose HTML-embeddable perl object
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for Apache::Wyrd.
Apache::Wyrd
To install Apache::Wyrd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Wyrd
CPAN shell
perl -MCPAN -e shell install Apache::Wyrd
For more information on module installation, please visit the detailed CPAN module installation guide.