This is mostly useful for subclassing existing loaders or in conjunction with "dump_to_dir".

loader_options

Argument: \%loader_options

Example in Synopsis above demonstrates a few common arguments. For detailed information on all of the arguments, most of which are only useful in fairly complex scenarios, see the DBIx::Class::Schema::Loader::Base documentation.

If you intend to use loader_options, you must call loader_options before any connection is made, or embed the loader_options in the connection information itself as shown below. Setting loader_options after the connection has already been made is useless.

connection

If the final argument is a hashref, and it contains the keys loader_options or loader_class, those keys will be deleted, and their values value will be used for the loader options or class, respectively, just as if set via the "loader_options" or "loader_class" methods above.

The actual auto-loading operation (the heart of this module) will be invoked as soon as the connection information is defined.

clone

dump_to_dir

Argument: $directory

Calling this as a class method on either DBIx::Class::Schema::Loader or any derived schema class will cause all schemas to dump manual versions of themselves to the named directory when they are loaded. In order to be effective, this must be set before defining a connection on this schema class or any derived object (as the loading happens as soon as both a connection and loader_options are set, and only once per class).

This can also be set at module import time via the import option dump_to_dir:/foo/bar to DBIx::Class::Schema::Loader, where /foo/bar is the target directory.

Examples:

# My::Schema isa DBIx::Class::Schema::Loader, and has connection info
# hardcoded in the class itself:
perl -MDBIx::Class::Schema::Loader=dump_to_dir:/foo/bar -MMy::Schema -e1
# Same, but no hard-coded connection, so we must provide one:
perl -MDBIx::Class::Schema::Loader=dump_to_dir:/foo/bar -MMy::Schema -e 'My::Schema->connection("dbi:Pg:dbname=foo", ...)'
# Or as a class method, as long as you get it done *before* defining a
# connection on this schema class or any derived object:
use My::Schema;
My::Schema->dump_to_dir('/foo/bar');
My::Schema->connection(........);
# Or as a class method on the DBIx::Class::Schema::Loader itself, which affects all
# derived schemas
use My::Schema;
use My::OtherSchema;
DBIx::Class::Schema::Loader->dump_to_dir('/foo/bar');
My::Schema->connection(.......);
My::OtherSchema->connection(.......);
# Another alternative to the above:
use DBIx::Class::Schema::Loader qw| dump_to_dir:/foo/bar |;
use My::Schema;
use My::OtherSchema;
My::Schema->connection(.......);
My::OtherSchema->connection(.......);

make_schema_at

Arguments: $schema_class_name, \%loader_options, \@connect_info

Return Value: $schema_class_name

This function creates a DBIx::Class schema from an existing RDBMS schema. With the dump_directory option, generates a set of DBIx::Class classes from an existing database schema read from the given dsn. Without a dump_directory, creates schema classes in memory at runtime without generating on-disk class files.