NAME
DBIx::POS - Define a dictionary of SQL statements in a POD dialect (POS)
SYNOPSIS
To define your dictionary:
package OurSQL;
use strict;
use warnings;
use base qw{DBIx::POS};
__PACKAGE__->instance (__FILE__);
=name testing
=desc test the DBI::POS module
=param
Some arbitrary parameter
=sql
There is really no syntax checking done on the content of the =sql section.
=cut
To use your dictionary:
package main;
use strict;
use warnings;
use OurSQL;
my $sql = OurSQL->instance;
$dbh->do ($sql->{testing});
DESCRIPTION
DBIx-POS subclasses Pod::Parser to define a POD dialect for writing a SQL dictionary for an application, and uses code from Class::Singleton to make the resulting structure easily accessible.
By encouraging the centralization of SQL code, it guards against SQL statement duplication (and the update problems that can generate).
By separating the SQL code from its normal context of execution, it encourages you to do other things with it---for instance, it is easy to create a script that can do performance testing of certain SQL statements in isolation, or to create generic command-line wrapper around your SQL statements.
By giving a framework for documenting the SQL, it encourages documentation of the intent and/or implementation of the SQL code. It also provides all of that information in a format from which other documentation could be generated---say, a chunk of DocBook for incorporation into a guide to programming the application.
EXPORT
Nothing is exported. Aren't singletons cool?
SEE ALSO
DBI, Pod::Parser, Class::Singleton
AUTHOR
Michael Alan Dorman, <mdorman@debian.org>
The instance routine is from Class::Singleton
Andy Wardley, <abw@cre.canon.co.uk>
Web Technology Group, Canon Research Centre Europe Ltd.
Thanks to Andreas Koenig <andreas.koenig@anima.de>
for providing some significant speedup patches and other ideas.
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Michael Alan Dorman
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The instance routine is from Class::Singleton
Copyright (C) 1998 Canon Research Centre Europe Ltd. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the term of the Perl Artistic License.