From: Mark Addison Date: Thu, 25 Nov 2004 23:10:59 +0000 (+0000) Subject: Deprecated ttargs producer arg in favour of tt_vars X-Git-Tag: v0.11008~592 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=329fc3f0ed7c802fb5a15b7e882817a4db031d80;p=dbsrgits%2FSQL-Translator.git Deprecated ttargs producer arg in favour of tt_vars --- diff --git a/lib/SQL/Translator/Producer/TTSchema.pm b/lib/SQL/Translator/Producer/TTSchema.pm index 89f77ca..de9f7bc 100644 --- a/lib/SQL/Translator/Producer/TTSchema.pm +++ b/lib/SQL/Translator/Producer/TTSchema.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::TTSchema; # ------------------------------------------------------------------- -# $Id: TTSchema.pm,v 1.8 2004-11-16 21:06:35 grommit Exp $ +# $Id: TTSchema.pm,v 1.9 2004-11-25 23:10:58 grommit Exp $ # ------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -114,7 +114,7 @@ A hash ref of extra variables you want to add to the template. use strict; use vars qw[ $DEBUG $VERSION @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Template; @@ -131,7 +131,12 @@ sub produce { my $scma = $translator->schema; my $args = $translator->producer_args; my $file = delete $args->{'ttfile'} or die "No template file!"; - my $ttvars = delete $args->{'ttargs'} || {}; + if ( exists $args->{ttargs} ) { + warn "Use of 'ttargs' producer arg is deprecated." + ." Please use 'tt_vars' instead.\n"; + $args->{tt_vars} = delete $args->{ttargs}; + } + my $ttvars = delete $args->{'tt_vars'} || {}; # Any args left here get given to the Template object. debug "Processing template $file\n"; diff --git a/t/18ttschema-producer.t b/t/18ttschema-producer.t index 8bf46c6..8f56c16 100644 --- a/t/18ttschema-producer.t +++ b/t/18ttschema-producer.t @@ -42,8 +42,8 @@ $obj = SQL::Translator->new( filename => "$Bin/data/xml/schema.xml", to => "TTSchema", producer_args => { - ttfile => "$Bin/data/template/basic.tt", - ttargs => { + ttfile => "$Bin/data/template/basic.tt", + tt_vars => { foo => 'bar', hello => 'world', },