Class::DBI::ClassGenerator - generate Class::DBI sub-class modules from a


Class-DBI-ClassGenerator documentation  | view source Contained in the Class-DBI-ClassGenerator distribution.

Index


NAME

Top

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

DESCRIPTION

Top

Yadda-yadda

SYNOPSIS

Top

Yadda-yadda

SUBROUTINES

Top

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

Top

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

DATABASES SUPPORTED

Top

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

Top


Class-DBI-ClassGenerator documentation  | view source Contained in the Class-DBI-ClassGenerator distribution.