Clarify POD and cleanup the ->name-hack warning
[dbsrgits/DBIx-Class.git] / lib / SQL / Translator / Parser / DBIx / Class.pm
index 6e6d193..de7c948 100644 (file)
@@ -82,13 +82,8 @@ sub parse {
         my $source = $dbicschema->source($moniker);
         my $table_name = $source->name;
 
-        if (ref $table_name) {
-          if (ref $table_name eq 'SCALAR') {
-            $table_name = $$table_name;
-          } else {
-            next;
-          }
-        }
+        # sqlt currently does not do quoting right anyway
+        $table_name = $$table_name if ref $table_name eq 'SCALAR';
 
         # Its possible to have multiple DBIC sources using the same table
         next if $tables{$table_name};
@@ -258,20 +253,19 @@ sub parse {
       $schema->add_table ($tables{$table}{object});
       $tables{$table}{source} -> _invoke_sqlt_deploy_hook( $tables{$table}{object} );
 
-      if ($schema->get_table($table) && $table =~ /\( \s* SELECT \s+/x) {
-        warn <<'EOF';
-Custom SQL through ->name(\'( SELECT ...') is DEPRECATED, see the "Arbitrary
-SQL" entry in:
-
-  perldoc DBIx::Class::Manual::Cookbook
-
-for the current method of doing this.
+      # the hook might have already removed the table
+      if ($schema->get_table($table) && $table =~ /^ \s* \( \s* SELECT \s+/ix) {
+        warn <<'EOW';
 
-To exclude this Result class from ->deploy, add the following to it:
+Custom SQL through ->name(\'( SELECT ...') is DEPRECATED, for more details see
+"Arbitrary SQL through a custom ResultSource" in DBIx::Class::Manual::Cookbook
+or http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod
 
-  sub sqlt_deploy_hook { $_[1]->schema->drop_table ($_[1]) }
+EOW
 
-EOF
+        # remove the table as there is no way someone might want to
+        # actually deploy this
+        $schema->drop_table ($table);
       }
     }