perlmeditation
jZed
I'd appreciate comments on a new module I've developed. Part of the POD is shown below. Please grab the [http://www.vpservices.com/jeff/programs/DBIx-LiveGrid-0.01.tar.gz|tarball] and let me know what you think.
<p>
<b>Update </b> See here for a [http://openrico.org/rico/livegrid.page|demo of LiveGrids].
</p>
<code>
=pod
=head1 NAME
DBIx::LiveGrid -- Ajax LiveGrid tables from any DBI data source
=head1 SYNOPSIS
B<Automatically generate a basic sortable and scrollable
liveGrid table>
This will read an Ajax request; auto-generate a SQL query
with ORDER BY, LIMIT and WHERE clauses; then send the
results of the query as an Ajax response composed of rows in
an XHTML table.
use DBI;
my $dbh = DBI->connect( ... any DBI datasource ... );
my $table_name = 'countries'
my @fields = qw/name population human_development_index/;
my @where = ('population > 100000000');
DBIx::LiveGrid->run( $dbh, $table_name, \@fields, \@where );
__END__
B<Or you can fine-tune the SQL and/or the XHTML yourself,
see the POD>
=head1 DESCRIPTION
This module provides a link between Rico LiveGrids
(dynamically scrollable database tables within web pages)
and DBI (Perl's database interface). With a half dozen
lines of perl script and a short HTML section, you can
create AJAX web windows into any DBI accessible database.
DBIx::LiveGrid lets you build web pages containing tables
which are dynamically sortable and scrollable. From the
user's perspective, live grids work like google maps -- as
you scroll through the grid, the data is dynamically
refreshed from the database. Users can also sort on any
column, simply by clicking on the column's header.
From the programmer's perspective, DBIx::LiveGrid is an
Ajax handler - it supplies XML data to XmlHttpRequests which
dynamically update parts of web pages. It requires a server
(a short CGI or mod_perl script you write to create and use
a DBIx::LiveGrid object) and an HTML client (a short HTML
page which you create based on supplied templates).
On the client-side, DBIx::LiveGrid works in conjunction with
two open source, easily available AJAX libraries (rico.js
and prototype.js). Rico developed the LiveGrid portion of
these libraries from work on very large databases (at Sabre
Airline Solutions) and have optimized the client end to
request only the data it needs at any one time, and to
buffer and cache data as needed.
On the server-side, DBIx::LiveGrid works in conjunction with
L<SQL::Abstract> and especially with L<SQL::Abstract::Limit>
to translate Rico's requests for specific chunks of data
into SQL clauses appropriate for any DBI data source. Or, if
you prefer, you can skip the auto-generation and build your
own SQL.
With Rico's optimzed AJAX on the frontend, DBIx::LiveGrid
and SQL::Abstract::Limit in the middle, and DBI at the
backend, you can serve very large databases and never query
or send more than small chunks of data at any one time.
=cut
</code>
Enjoy!