1AnyData::Format::HTMLtaUbsleer(3C)ontributed Perl DocumeAnntyaDtaitoan::Format::HTMLtable(3)
2
3
4

NAME

6       HTMLtable - tied hash and DBI/SQL access to HTML tables
7

SYNOPSIS

9        use AnyData;
10        my $table = adHash( 'HTMLtable', $filename );
11        while (my $row = each %$table) {
12           print $row->{name},"\n" if $row->{country} =~ /us|mx|ca/;
13        }
14        # ... other tied hash operations
15
16        OR
17
18        use DBI
19        my $dbh = DBI->connect('dbi:AnyData:');
20        $dbh->func('table1','HTMLtable', $filename,'ad_catalog');
21        my $hits = $dbh->selectall_arrayref( qq{
22            SELECT name FROM table1 WHERE country = 'us'
23        });
24        # ... other DBI/SQL operations
25

DESCRIPTION

27       This module allows one to treat the data contained in an HTML table as
28       a tied hash (using AnyData.pm) or as a DBI/SQL accessible database
29       (using DBD::AnyData.pm).  Both the tiedhash and DBI interfaces allow
30       one to read, modify, and create HTML tables from perl data or from
31       local or remote files.
32
33       The module requires that CGI, HTML::Parser and HTML::TableExtract are
34       installed.
35
36       When reading the HTML table, this module is essentially just a pass
37       through to Matt Sisk's excellent HTML::TableExtract module.
38
39       If no flags are specified in the adTie() or ad_catalog() calls, then
40       TableExtract is called with depth=0 and count=0, in other words it
41       finds the first row of the first table and treats that as the column
42       names for the entire table.  If a flag for 'cols' (column names) is
43       specified in the adTie() or ad_catalog() calls, that list of column
44       names is passed to TableExtract as a headers parameter.  If the user
45       specifies flags for headers, depth, or count, those are passed directly
46       to TableExtract.
47
48       When exporting to an HTMLtable, you may pass flags to specify
49       properties
50        of the whole table (table_flags), the top row containing the column
51       names
52        (top_row_flags), and the data rows (data_row_flags).  These flags
53       follow
54        the syntax of CGI.pm table constructors, e.g.:
55
56        print adExport( $table, 'HTMLtable', {
57            table_flags    => {Border=>3,bgColor=>'blue'};
58            top_row_flags  => {bgColor=>'red'};
59            data_row_flags => {valign='top'};
60        });
61
62        The table_flags will default to {Border=>1,bgColor=>'white'} if none
63        are specified.
64
65        The top_row_flags will default to {bgColor=>'#c0c0c0'} if none are
66        specified;
67
68        The data_row_flags will be empty if none are specified.
69
70        In other words, if no flags are specified the table will print out with
71        a border of 1, the column headings in gray, and the data rows in white.
72
73        CAUTION: This module will *not* preserve anything in the html file except
74        the selected table so if your file contains more than the selected table,
75        you will want to use adTie() or $dbh->func(...,'ad_import') to read the
76       table and then adExport() or $dbh->func(...,'ad_export') to write
77        the table to a different file.  When using the HTMLtable format, this is the
78        only way to preserve changes to the data, the adTie() command will *not*
79        write to a file.
80
82       copyright 2000, Jeff Zucker <jeff@vpservices.com> all rights reserved
83
84
85
86perl v5.32.1                      2021-01-26     AnyData::Format::HTMLtable(3)
Impressum