Robert Kiesling > DBIx-HTMLTable-0.24 > DBIx::HTMLTable

Download:
DBIx-HTMLTable-0.24.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.24   Source  

NAME ^

   HTMLTable - Create HTML table from DBI query output.

SYNOPSIS ^

    use DBIx::HTMLTable;

    HTMLTable ($data, <options>);

    HTMLTableByRef ($dataref, <options>);

DESCRIPTION ^

HTMLTable() formats the results of a DBI query as a HTML table. The first argument is the query output formatted as a multi-line string, with columns delimited by a field separator (a comma by default) and rows delimited by a record separator (newline by default). The second argument is a hash of options and table attributes. Options and attributes are described below.

    &DBIx::HTMLTable::HTMLTable ($data, 
                                {rs => "\n",
                                fs => ',',
                                caption => "Caption Text"});

HTMLTableByRef() takes as its first argument a reference to an array of array references, as returned by DBI's fetchall_arrayref() and similar functions. As with HTMLTable(), the second argument is a hash of valid options and attributes.

  $tableref = $dbh -> selectall_arrayref( "SELECT \* FROM $db" );
  HTMLTableByRef ($tableref, 
                  {bgcolor => 'white',
                   caption => "$db SELECT Query",
                   border => 2,
                   width => 300});

The file eg/tablequery.cgi is an example CGI script that formats query output for viewing in a Web browser.

OPTIONS ^

Options determine how to interpret data and how to construct tables.

rs

HTMLTable only. Character delimiter for data rows.

fs

HTMLTable only. Character delimiter for data columns.

caption

If the value of this option is a non-empty string, formats the string as the table's caption.

TABLE ATTRIBUTES ^

The following is a brief list of attributes that the HTML 4.0 <TABLE> tag recognizes. Refer to the HTML 4.0 specification (http://www.w3.org/) for detailed information about each attribute.

align
width
cols
id
class
dir
title
style
onclick
ondbclick
onmousedown
onmouseup
onmouseover
onmousemove
onmouseout
onkeypress
onkeydown
onkeyup
bgcolor
frame
rules
border
cellspacing
cellpadding

VERSION ^

Version 0.24

COPYRIGHT ^

Copyright © 2001-2004 Robert Kiesling, rkies@cpan.org.

Licensed using the same terms as Perl. Refer to the file, "Artistic," for information.

AUTHOR ^

Robert Kiesling, rkies@cpan.org

SEE ALSO ^

DBI(3)

syntax highlighting: