Release commit for 1.62
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator.pm
index f59c763..cab19d2 100644 (file)
@@ -3,7 +3,8 @@ package SQL::Translator;
 use Moo;
 our ( $DEFAULT_SUB, $DEBUG, $ERROR );
 
-our $VERSION  = '0.11013_03';
+our $VERSION  = '1.62';
+$VERSION =~ tr/_//d;
 $DEBUG    = 0 unless defined $DEBUG;
 $ERROR    = "";
 
@@ -17,7 +18,7 @@ use IO::Dir;
 use Sub::Quote qw(quote_sub);
 use SQL::Translator::Producer;
 use SQL::Translator::Schema;
-use SQL::Translator::Utils qw(throw ex2err carp_ro);
+use SQL::Translator::Utils qw(throw ex2err carp_ro normalize_quote_options);
 
 $DEFAULT_SUB = sub { $_[0]->schema } unless defined $DEFAULT_SUB;
 
@@ -40,40 +41,7 @@ around BUILDARGS => sub {
 
     $config->{filename} ||= $config->{file} if defined $config->{file};
 
-    my $quote;
-    if (defined $config->{quote_identifiers}) {
-      $quote = $config->{quote_identifiers};
-
-      for (qw/quote_table_names quote_field_names/) {
-        carp "Ignoring deprecated parameter '$_', since 'quote_identifiers' is supplied"
-          if defined $config->{$_}
-      }
-    }
-    # Legacy one set the other is not
-    elsif (
-      defined $config->{'quote_table_names'}
-        xor
-      defined $config->{'quote_field_names'}
-    ) {
-      if (defined $config->{'quote_table_names'}) {
-        carp "Explicitly disabling the deprecated 'quote_table_names' implies disabling 'quote_identifiers' which in turn implies disabling 'quote_field_names'"
-          unless $config->{'quote_table_names'};
-        $quote = $config->{'quote_table_names'} ? 1 : 0;
-      }
-      else {
-        carp "Explicitly disabling the deprecated 'quote_field_names' implies disabling 'quote_identifiers' which in turn implies disabling 'quote_table_names'"
-          unless $config->{'quote_field_names'};
-        $quote = $config->{'quote_field_names'} ? 1 : 0;
-      }
-    }
-    # Legacy both are set
-    elsif(defined $config->{'quote_table_names'}) {
-      croak 'Setting quote_table_names and quote_field_names to conflicting values is no longer supported'
-        if ($config->{'quote_table_names'} xor $config->{'quote_field_names'});
-
-      $quote = $config->{'quote_table_names'} ? 1 : 0;
-    }
-
+    my $quote = normalize_quote_options($config);
     $config->{quote_identifiers} = $quote if defined $quote;
 
     return $config;
@@ -181,7 +149,7 @@ has filters => (
                 next;
             }
             else {
-                __PACKAGE__->debug("Adding $filt filter. Args:".Dumper(\@args)."\n");
+                __PACKAGE__->debug("Adding $filt filter. Args:".Dumper(\@args)."\n") if __PACKAGE__->debugging;
                 $filt = _load_sub("$filt\::filter", "SQL::Translator::Filter")
                     || throw(__PACKAGE__->error);
                 push @filters, [$filt,@args];
@@ -201,12 +169,14 @@ around filters => sub {
 has filename => (
     is => 'rw',
     isa => sub {
-        my $filename = shift;
-        if (-d $filename) {
-            throw("Cannot use directory '$filename' as input source");
-        } elsif (not -f _ && -r _) {
-            throw("Cannot use '$filename' as input source: ".
-                  "file does not exist or is not readable.");
+        foreach my $filename (ref($_[0]) eq 'ARRAY' ? @{$_[0]} : $_[0]) {
+            if (-d $filename) {
+                throw("Cannot use directory '$filename' as input source");
+            }
+            elsif (not -f _ && -r _) {
+                throw("Cannot use '$filename' as input source: ".
+                      "file does not exist or is not readable.");
+            }
         }
     },
 );
@@ -392,7 +362,7 @@ sub translate {
             return $self->error($msg);
         }
     }
-    $self->debug("Schema =\n", Dumper($self->schema), "\n");
+    $self->debug("Schema =\n", Dumper($self->schema), "\n") if $self->debugging;;
 
     # Validate the schema if asked to.
     if ($self->validate) {
@@ -765,6 +735,8 @@ UPDATE, DELETE).
 
 =head1 CONSTRUCTOR
 
+=head2 new
+
 The constructor is called C<new>, and accepts a optional hash of options.
 Valid options are:
 
@@ -957,7 +929,7 @@ analogously to C<producer_type> and C<producer_args>
 
 =head2 filters
 
-Set or retreive the filters to run over the schema during the
+Set or retrieve the filters to run over the schema during the
 translation, before the producer creates its output. Filters are sub
 routines called, in order, with the schema object to filter as the 1st
 arg and a hash of options (passed as a list) for the rest of the args.
@@ -1106,14 +1078,55 @@ Returns the version of the SQL::Translator release.
 See the included AUTHORS file:
 L<http://search.cpan.org/dist/SQL-Translator/AUTHORS>
 
-If you would like to contribute to the project, you can send patches
-to the developers mailing list:
+=head1 GETTING HELP/SUPPORT
+
+If you are stuck with a problem or have doubts about a particular
+approach do not hesitate to contact us via any of the following
+options (the list is sorted by "fastest response time"):
+
+=over
+
+=item * IRC: irc.perl.org#sql-translator
+
+=for html
+<a href="https://chat.mibbit.com/#sql-translator@irc.perl.org">(click for instant chatroom login)</a>
+
+=item * Mailing list: L<http://lists.scsys.co.uk/mailman/listinfo/dbix-class>
 
-    sqlfairy-developers@lists.sourceforge.net
+=item * RT Bug Tracker: L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Translator>
 
-Or send us a message (with your Sourceforge username) asking to be
-added to the project and what you'd like to contribute.
+=back
+
+=head1 HOW TO CONTRIBUTE
+
+Contributions are always welcome, in all usable forms (we especially
+welcome documentation improvements). The delivery methods include git-
+or unified-diff formatted patches, GitHub pull requests, or plain bug
+reports either via RT or the Mailing list. Contributors are generally
+granted access to the official repository after their first several
+patches pass successful review. Don't hesitate to
+L<contact|/GETTING HELP/SUPPORT> us with any further questions you may
+have.
+
+This project is maintained in a git repository. The code and related tools are
+accessible at the following locations:
+
+=over
+
+=item * Official repo: L<git://git.shadowcat.co.uk/dbsrgits/SQL-Translator.git>
+
+=item * Official gitweb: L<http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/SQL-Translator.git>
 
+=item * GitHub mirror: L<https://github.com/dbsrgits/SQL-Translator>
+
+=item * Authorized committers: L<ssh://dbsrgits@git.shadowcat.co.uk/sql-translator.git>
+
+=item * Travis-CI log: L<https://travis-ci.org/dbsrgits/sql-translator/builds>
+
+=for html
+&#x21AA; Stable branch CI status: <img src="https://secure.travis-ci.org/dbsrgits/sql-translator.png?branch=master"></img>
+
+=back
 
 =head1 COPYRIGHT
 
@@ -1124,10 +1137,6 @@ Copyright 2012 the SQL::Translator authors, as listed in L</AUTHORS>.
 This library is free software and may be distributed under the same terms as
 Perl 5 itself.
 
-=head1 BUGS
-
-Please use L<http://rt.cpan.org/> for reporting bugs.
-
 =head1 PRAISE
 
 If you find this module useful, please use