DBIx::Browse::CGI - Perl extension to browse tables with a CGI interface.
use DBIx::Browse::CGI;
my ($dbh, $dbb, $q);
$dbh = DBI->connect("DBI:Pg:dbname=enterprise")
or croak "Can't connect to database: $@";
$q = new CGI;
$dbb = new DBIx::Browse::CGI({
dbh => $dbh,
table => 'employee',
proper_fields => [ qw ( name fname ) ],
linked_fields => [ qw ( department category office ) ],
linked_tables => [ qw ( department category office ) ],
linked_values => [ qw ( name name phone ) ],
linked_refs => [ qw ( id id ide ) ],
aliases => [ qw ( name fname department category phone )],
primary_key => 'id',
cgi => $q
});
print
$q->start_html(
-title => "Test DBIx::Browse::CGI"
);
$dbb->list_form({
field_order => [ 1, 0, 4, 3, 2 ],
field_length => [ 14, 15, 15, 15, 10 ]
});
...etc
The purpose of DBIx::Browse::CGI is to handle the browsing of relational tables with a human-like interface via Web.
DBIx::Browse::CGI transparently translates SELECTs, UPDATEs, DELETEs and INSERTs from the desired ``human view'' to the values needed for the table. This is the case when you have related tables (1 to n) where the detail table has a reference (FOREIGN KEY) to a generic table (i.e. Customers and Bills) with some index (tipically an integer).
All the inherited methods inherited from its parent class (DBIX::Browse(3)) plus the following:
It takes one optional parameter with a hash reference with the following keys:
It takes one optional parameter with a hash reference with the same structure than list_form.
It takes one optional parameter with a hash reference with the same structure than list_form.
Evilio José del Río Silván, edelrio@icm.csic.es
perl(1), DBI(3), CGI(3), DBIx::Browse(3).