use Moose;
no warnings 'uninitialized';
-our $VERSION = '0.47';
+our $VERSION = '0.50';
$VERSION = eval $VERSION;
use Carp;
C<traits> is the list of traits to apply to the model, see
L<Catalyst::Model::DBIC::Schema> for details.
-C<Schema::Loader opts> are described in L</TYPICAL EXAMPLES> below.
+C<Schema::Loader opts> are documented in L<DBIx::Class::Schema::Loader::Base>
+and some examples are given in L</TYPICAL EXAMPLES> below.
-C<connect_info> arguments are the same as what
-DBIx::Class::Schema::connect expects, and are storage_type-specific.
-For DBI-based storage, these arguments are the dsn, username,
-password, and connect options, respectively. These are optional for
-existing Schemas, but required if you use either of the C<create=>
-options.
+C<connect_info> arguments are the same as what L<DBIx::Class::Schema/connect>
+expects, and are storage_type-specific. They are documented in
+L<DBIx::Class::Storage::DBI/connect_info>. For DBI-based storage, these
+arguments are the dsn, username, password, and connect options, respectively.
+These are optional for existing Schemas, but required if you use either of the
+C<create=> options.
username and password can be omitted for C<SQLite> dsns.
script/myapp_create.pl model CatalystModelName DBIC::Schema \
MyApp::SchemaClass create=static dbi:SQLite:foo.db \
AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \
- on_connect_do='["select 1", "select 2"]' quote_char='"'
-
-If using a 2 character quote_char:
-
- script/myapp_create.pl ... quote_char='[]'
+ on_connect_do='["select 1", "select 2"]' quote_names=1
B<ON WINDOWS COMMAND LINES QUOTING RULES ARE DIFFERENT>
script/myapp_create.pl model CatalystModelName DBIC::Schema \
MyApp::SchemaClass create=static dbi:SQLite:foo.db \
AutoCommit=1 cursor_class=DBIx::Class::Cursor::Cached \
- on_connect_do="[\"select 1\", \"select 2\"]" quote_char="\""
+ on_connect_do="[\"select 1\", \"select 2\"]" quote_names=1
Same, but with extra Schema::Loader args (separate multiple values by commas):
File::Spec->catfile($self->helper->{base}, 'lib', @schema_parts) . '.pm';
if (not -f $schema_pm) {
- try { Class::MOP::load_class('DBIx::Class::Schema::Loader') };
+ eval { Class::MOP::load_class('DBIx::Class::Schema::Loader') };
return 'Result' if $@;
- return try { DBIx::Class::Schema::Loader->VERSION('0.05') } ? 'Result' : '';
+ return (try { DBIx::Class::Schema::Loader->VERSION('0.05') }) ? 'Result' : '';
}
open my $fh, '<', $schema_pm or die "Could not open $schema_pm: $!";
my ($result_namespace) = $code =~ /result_namespace => '([^']+)'/;
- if (not $result_namespace) {
- if ($code =~ /->load_classes/) {
- $result_namespace = '';
- }
- else {
- $result_namespace = 'Result';
- }
- }
+ return $result_namespace if $result_namespace;
- return $result_namespace;
+ return '' if $code =~ /->load_classes/;
+
+ return 'Result';
}
sub _data_struct_to_string {
my $schema_dir = File::Spec->catfile($helper->{base}, 'lib');
- try { Class::MOP::load_class('DBIx::Class::Schema::Loader') };
- die "Cannot load DBIx::Class::Schema::Loader: $@" if $@;
+ try {
+ Class::MOP::load_class('DBIx::Class::Schema::Loader')
+ }
+ catch {
+ die "Cannot load DBIx::Class::Schema::Loader: $_";
+ };
DBIx::Class::Schema::Loader->import(
"dump_to_dir:$schema_dir", 'make_schema_at'