NAME

Class::DBI::ClassGenerator - generate Class::DBI sub-class modules from a pre-exsting database's structure.

SUPPORT

This module is unsupported, unloved, unmaintained, and DEPRECATED. No bugs will be fixed. No patches will be accepted. No users will be helped. All bug reports will be either ignored or rejected.

I strongly recommend that you switch from using Class::DBI to using DBIx::Class instead, and DBIx::Class::Schema::Loader instead of this module.

Unless, that is, someone else takes over ownership.

SUBROUTINES

create

This takes the following named parameters:

directory (compulsory)

The name of the directory into which to drop the generated classes. If it doesn't exist it will be created. Sub-directories will be created under here as appropriate.

directory => 'lib'
connect_info (compulsory)

An arrayref of the DSN, username and password to connect to the database.

connect_info => ['dbi:mysql:dbname', 'username', 'password']
base_class (compulsory)

The name of the base class that all your table classes will inherit their database connection from.

base_class => 'MyApp::DB'
tables (optional)

A hashref whose keys are table names in the database and the values are the classnames you desire.

tables => {
    artists => 'MyApp::Artist',
    tracks  => 'MyApp::Track',
    albums  => 'MyApp::Album',
    ...
}

If you leave this out, the code will assume that you want classes for all tables, and that their names should be generated thus:

The first character of the tablename is converted to uppercase;

An underscore followed by a character becomes the character, in
uppercase

The base class name and :: is prepended.

This is probably a close approximation for what you want anyway.

It returns a list of all the files created.

BUGS and WARNINGS

This should be considered to be pre-production code. It's probably chock full of exciting bugs.

DATABASES SUPPORTED

MySQL and SQLite are supported "out-of-the-box". Adding other databases is a simple matter of writing a "driver" module with two simple methods. You are encouraged to upload such modules to the CPAN yourself.

Class::DBI::ClassGenerator::Extending, for how to interrogate other databases.

AUTHOR, COPYRIGHT and LICENCE

Written by David Cantrell <david@cantrell.org.uk>

Copyright 2008-2009 Outcome Technologies Ltd

This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.