Evilio José del Río Silván


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
                   -title => "Test DBIx::Browse::CGI"
    field_order  => [  1,  0,  4,  3,  2 ],
    field_length => [ 14, 15, 15, 15, 10 ]



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 methods inherited from its parent class (DBIX::Browse(3)) plus the following:


Creates a new DBIx::Browse::CGI object. The parameters are passed through a hash with the following added keys with respect to DBIx::Browse::new:


A CGI object that will be used for Web interaction. If it is not defined a new CGI object will be created.


The maximum number of rows to be displayed per Web page (default: 10).


The maximum field length to be displayed (also the default for unknown field lengths).


The order to be used to order rows (e.g. 'NAME ASC, DATE DESC').


The default action (web page) that will be displayed if not set by the calling program (currently "List" or "Edit".


A hash ref containing other form parameters that will appear as "HIDDEN" input fields.


An anonymous arrays of css styles ("CLASS") that will be applied to succesive rows of output.


If set, the output methods (list_form, edit_form, and browse) will not print directly. Instead, they will return a string containig the output (in fact they always do). Otherwise they will print directly to standard output (default: 0).


This method produces a CGI form suitable to explore the main table. It will list its rows in chunks of max_rows. It will present also the possibility to edit (see edit_form) any row and to filter the rows to display.

It takes one optional parameter with a hash reference with the following keys:


An array reference containing the field names to be displayed.


An array reference with the desired order index in wich the fields will appear.


An array reference with the desired field length.


This method produces a CGI form suitable to browse the main table record by record. You can update, delete and insert new records.

It takes one optional parameter with a hash reference with the same structure than list_form.


This method will call list_form or edit_form as needed depending on the user input.

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).

1 POD Error

The following errors were encountered while parsing the POD:

Around line 888:

Non-ASCII character seen before =encoding in 'José'. Assuming ISO8859-1