The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Teng::Schema::Dumper - Schema code generator

SYNOPSIS

    use DBI;
    use Teng::Schema::Dumper;

    my $dbh = DBI->connect(@dsn) or die;
    print Teng::Schema::Dumper->dump(dbh => $dbh, namespace => 'Mock::DB');

DESCRIPTION

This module generates the Perl code to generate Teng::Schema instance.

You can use it by do "my/schema.pl" or embed it to the package.

THIS MODULE IS HIGHLY EXPERIMENTAL. DO NOT USE THIS FOR PRODUCTION ENVIRONMENT.

METHODS

Teng::Dumper->dump(dbh => $dbh, table2class_cb => \&code);

This is the method to generate code from DB. It returns the Perl5 code in string.

The arguments are:

dbh

Database handle from DBI.

table2class_cb

Coderef to convert table name to row class name.

The method is calling with following form:

    my $class_name = $code->($table_name);