Improve trigger 'scope' attribute support (RT#119997)
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Producer / TTSchema.pm
index 38cd3e3..36f62b6 100644 (file)
@@ -1,26 +1,6 @@
 package SQL::Translator::Producer::TTSchema;
 
-# -------------------------------------------------------------------
-# $Id$
-# -------------------------------------------------------------------
-# Copyright (C) 2002-4 SQLFairy Authors
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307  USA
-# -------------------------------------------------------------------
-
-=pod 
+=pod
 
 =head1 NAME
 
@@ -38,12 +18,12 @@ SQL::Translator::Producer::TTSchema -
           ttfile     => 'foo_template.tt',  # Template file to use
 
           # Extra template variables
-          ttargs     => {
+          tt_vars     => {
               author => "Mr Foo",
           },
 
           # Template config options
-          ttargs     => {
+          tt_conf     => {
               INCLUDE_PATH => '/foo/templates',
           },
       },
@@ -54,7 +34,7 @@ SQL::Translator::Producer::TTSchema -
 
 Produces schema output using a given Template Tookit template.
 
-It needs one additional producer_arg of C<ttfile> which is the file
+It needs one additional producer arg of C<ttfile> which is the file
 name of the template to use.  This template will be passed a variable
 called C<schema>, which is the C<SQL::Translator::Producer::Schema> object
 created by the parser. You can then use it to walk the schema via the
@@ -74,13 +54,15 @@ Here's a brief example of what the template could look like:
 
 See F<t/data/template/basic.tt> for a more complete example.
 
-The template will also get the set of extra variables given as a hashref via the
-C<tt_vars> producer arg.
+The template will also get the set of extra variables given as a
+hashref via the C<tt_vars> producer arg. (Note that the old style of
+passing this config in the C<ttargs> producer arg has been
+deprecated).
 
-You can set any of the options used to initiallize the Template object by
-adding a tt_conf producer_arg. See Template Toolkit docs for details of
+You can set any of the options used to initialize the Template object by
+adding a C<tt_conf> producer arg. See Template Toolkit docs for details of
 the options.
-(Note that the old style of passing this config directly in the producer args
+(Note that the old style of passing this config directly in the C<ttargs> producer args
 has been deprecated).
 
 
@@ -88,8 +70,8 @@ has been deprecated).
       to               => 'TT',
       producer_args    => {
           ttfile       => 'foo_template.tt',
-          ttargs       => {},
-          tt_conf      = {
+          tt_vars      => {},
+          tt_conf      => {
             INCLUDE_PATH => '/foo/templates/tt',
             INTERPOLATE  => 1,
           }
@@ -124,12 +106,11 @@ constructor.
 
 =cut
 
-# -------------------------------------------------------------------
-
 use strict;
+use warnings;
 
-use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/;
+our ( $DEBUG, @EXPORT_OK );
+our $VERSION = '1.59';
 $DEBUG   = 0 unless defined $DEBUG;
 
 use Template;
@@ -157,7 +138,7 @@ sub produce {
     my %tt_conf = exists $args->{tt_conf} ? %{$args->{tt_conf}} : ();
     # sqlt passes the producer args for _all_ producers in, so we use this
     # grep hack to test for the old usage.
-    debug(Dumper(\%tt_conf));
+    debug(Dumper(\%tt_conf)) if $DEBUG;
     if ( grep /^[A-Z_]+$/, keys %$args ) {
         warn "Template config directly in the producer args is deprecated."
             ." Please use 'tt_conf' instead.\n";
@@ -188,8 +169,6 @@ sub produce {
 
 1;
 
-# -------------------------------------------------------------------
-
 =pod
 
 =head1 AUTHOR