DBIx-Browse
view release on metacpan or search on metacpan
#
# flush
#
sub flush {
my $self = shift;
my $request = $self->{cgi_buffer};
print $request
unless ($self->{noprint});
$self->{cgi_buffer} = '';
return $request;
}
#########################################################################
1;
#
#
#
__END__
=head1 NAME
DBIx::Browse::CGI - Perl extension to browse tables with a CGI interface.
=head1 SYNOPSIS
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
=head1 DESCRIPTION
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).
=head1 METHODS
All the methods inherited from its parent class
(DBIX::Browse(3)) plus the following:
=over 4
=item B<new>
Creates a new DBIx::Browse::CGI object. The parameters are passed
through a hash with the following added keys with respect to
B<DBIx::Browse::new>:
=over 4
=item I<cgi>
A CGI object that will be used for Web interaction. If it is not
defined a new CGI object will be created.
=item I<max_rows>
The maximum number of rows to be displayed per Web page (default: 10).
=item I<max_flength>
The maximum field length to be displayed (also the default for unknown
field lengths).
=item I<row_order>
The order to be used to order rows (e.g. 'NAME ASC, DATE DESC').
=item I<default_action>
The default action (web page) that will be displayed if not set by the
calling program (currently "List" or "Edit".
=item I<form_params>
A hash ref containing other form parameters that will appear as
"HIDDEN" input fields.
=item I<styles>
An anonymous arrays of css styles ("CLASS") that will be applied to
succesive rows of output.
=item I<no_print>
If set, the output methods (B<list_form>, B<edit_form>, and B<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).
( run in 1.716 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )