add documentation links to helper POD
[catagits/Catalyst-Model-DBIC-Schema.git] / lib / Catalyst / Helper / Model / DBIC / Schema.pm
index a787349..16e8634 100644 (file)
@@ -4,7 +4,7 @@ use namespace::autoclean;
 use Moose;
 no warnings 'uninitialized';
 
-our $VERSION = '0.47';
+our $VERSION = '0.50';
 $VERSION = eval $VERSION;
 
 use Carp;
@@ -61,14 +61,15 @@ the generated classes by hand to refine them.
 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.
 
@@ -88,11 +89,7 @@ user and pass can be omitted for sqlite, since they are always empty
   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>
 
@@ -101,7 +98,7 @@ In C<cmd.exe> the above example would be:
   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):
 
@@ -439,11 +436,11 @@ sub _build_result_namespace {
         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: $!";
@@ -452,16 +449,11 @@ sub _build_result_namespace {
 
     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 {
@@ -588,8 +580,12 @@ sub _gen_static_schema {
 
     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'