X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FTranslator%2FProducer%2FTTSchema.pm;h=36f62b6ab978b85464adffe590b1faaa0ffa4cb6;hb=c0ec0e22d3f0e3852c00daac5ef5763010b410c3;hp=839e22e6c087dde7785c9433228f051de9a0274a;hpb=44659089c28216f1984873bc4aa8641e2e0e3410;p=dbsrgits%2FSQL-Translator.git diff --git a/lib/SQL/Translator/Producer/TTSchema.pm b/lib/SQL/Translator/Producer/TTSchema.pm index 839e22e..36f62b6 100644 --- a/lib/SQL/Translator/Producer/TTSchema.pm +++ b/lib/SQL/Translator/Producer/TTSchema.pm @@ -1,24 +1,6 @@ package SQL::Translator::Producer::TTSchema; -# ------------------------------------------------------------------- -# Copyright (C) 2002-2009 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 @@ -36,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', }, }, @@ -52,7 +34,7 @@ SQL::Translator::Producer::TTSchema - Produces schema output using a given Template Tookit template. -It needs one additional producer_arg of C which is the file +It needs one additional producer arg of C which is the file name of the template to use. This template will be passed a variable called C, which is the C object created by the parser. You can then use it to walk the schema via the @@ -72,13 +54,15 @@ Here's a brief example of what the template could look like: See F for a more complete example. -The template will also get the set of extra variables given as a hashref via the -C producer arg. +The template will also get the set of extra variables given as a +hashref via the C producer arg. (Note that the old style of +passing this config in the C 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 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 producer args has been deprecated). @@ -86,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, } @@ -122,12 +106,11 @@ constructor. =cut -# ------------------------------------------------------------------- - use strict; +use warnings; -use vars qw[ $DEBUG $VERSION @EXPORT_OK ]; -$VERSION = '1.59'; +our ( $DEBUG, @EXPORT_OK ); +our $VERSION = '1.59'; $DEBUG = 0 unless defined $DEBUG; use Template; @@ -155,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"; @@ -186,8 +169,6 @@ sub produce { 1; -# ------------------------------------------------------------------- - =pod =head1 AUTHOR