schema-dumper: autogenerate schema packages with DBIx::Class::Schema::Loader
This is a bit rudimentary (and rough with poor feedback) but it’s a nice stub.
Update: 25 March 2009 · I don’t recommend this right now. It’s okay but there is a really nice way to integrate it into your apps which I’ll post one of these days.
use strict; use warnings; use DBIx::Class::Schema::Loader qw/ make_schema_at /; use Getopt::Long; use Pod::Usage; # Program proper #--------------------------------------------------------------------- pod2usage(2) unless @ARGV; my %config; GetOptions( "name=s" => \$config{name}, "dir=s" => \$config{dir}, "dsn=s" => \$config{dsn}, "user=s" => \$config{user}, "password=s" => \$config{password}, "debug" => \$config{debug}, "help" => sub { pod2usage(1) }, ) or pod2usage(2); #use Data::Dumper; die Dumper \%config; make_schema_at( $config{name}, { debug => $config{debug} || 0, dump_directory => $config{dir} }, [ $config{dsn}, $config{user}, $config{password}, ], ); exit 0; # Subroutines #--------------------------------------------------------------------- __DATA__ To handle? "skip_relationships" "db_schema" "constraint" "exclude" "moniker_map" "inflect_plural" "inflect_singular" "additional_base_classes" "left_base_classes" "additional_classes" "components" "resultset_components" "dump_directory" "dump_overwrite" "really_erase_my_files" =head1 NAME schema-maker -- Generate schema packages with L<DBIx::Class::Schema::Loader>. =head1 SYNOPSIS schema-dumper [options] Options: --name=Schema::ClassName The class name for your schema. --dir=/where/to/dump/lib The location to write the files. --dsn="DBI:mysql:my_db;mysql_read_default_file=$cnf_file;" The DSN, DB connection string. --debug Passed to DBIx::Class::Schema::Loader. --user Passed to DBIx::Class::Schema::Loader. --password Passed to DBIx::Class::Schema::Loader. --help Print this message. =head2 EXAMPLE # should be here =head1 SEE ALSO L<DBIx::Class>, L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema>. =cut





