Welcome to the DBIx::XHTML_Table homepage. The homepage is still in the early stages of construction. The target browser for this site is Mozilla 0.9.7 - but i do check in other browsers from time to time. If you spot some glaring piece of CSS monstronsity that surely is not suppose to look like that then please let me know.

DBIx::XHTML_Table is a DBI extension that creates an XHTML table from a database query. It was created to fill the gap between fetching rows from a database and transforming them into a web browser renderable table. Of the two tasks, DBIx::XHTML_Table focuses primarly on transformation.

Below is a sample Perl script using DBIx::XHTML_Table on the left and the resulting XHTML rendered on the right. This example is broken into pieces for any easy intro into DBIx::XHTML_Table at the Tutorial.


my $table = DBIx::XHTML_Table->new(
  'DBI:vendor:database:host',
  'user', 'pass',
);

$table->exec_query("
  select artist, album, title as song
  from temp order by artist,album
");

$table->modify(table => { 
  border => 1,
});

$table->modify(th => {
  style => { 
    color      => '#a9b9a9',
    background => '#444444',
  }
});

$table->modify(tr => { 
  style => {
    background => ['#bacaba','#cbdbcb']
  }
});

print $table->output();
Artist Album Song
Air Moon Safari La Femme DArgent
Bjork Telegram Army Of Me
Bjork Telegram Isobel
Ozric Tentacles Jurassic Shift Sunhair
Ozric Tentacles The Hidden Step Pixel Dream
Ozric Tentacles The Hidden Step Tight Spin
Ozric Tentacles The Hidden Step Holohedron
The Police Ghost In The Machine Invisible Sun
The Police Reggatta De Blanc Does Everyone Stare
The Police Reggatta De Blanc Walking On The Moon

DBIx::XHTML_Table does not enforce XHTML attributes. In fact, it is designed to accept ANY attribute whether valid or not. For example, the above code uses the HTML attribute 'border'. This flexible nature of DBIx::XHTML_Table allows you to choose which style to use, and hopefully will accomodate any new attributes as well.


spleck.net mod_perl MySQL CPAN