Strip evil svn:keywords
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Producer / TTSchema.pm
index 8601253..ee5a7f1 100644 (file)
@@ -1,9 +1,9 @@
 package SQL::Translator::Producer::TTSchema;
 
 # -------------------------------------------------------------------
-# $Id: TTSchema.pm,v 1.10 2004-11-26 00:28:06 grommit Exp $
+# $Id: TTSchema.pm 1440 2009-01-17 16:31:57Z jawnsy $
 # -------------------------------------------------------------------
-# Copyright (C) 2002-4 SQLFairy Authors
+# 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
@@ -128,8 +128,7 @@ constructor.
 
 use strict;
 
-use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/;
+use vars qw[ $DEBUG @EXPORT_OK ];
 $DEBUG   = 0 unless defined $DEBUG;
 
 use Template;
@@ -157,6 +156,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));
     if ( grep /^[A-Z_]+$/, keys %$args ) {
         warn "Template config directly in the producer args is deprecated."
             ." Please use 'tt_conf' instead.\n";
@@ -170,13 +170,17 @@ sub produce {
         ABSOLUTE => 1, # Set so we can use from the command line sensibly
         RELATIVE => 1, # Maybe the cmd line code should set it! Security!
         %tt_conf,
-    ) || die "Failed to initialize Template object: ".Template->error;
+    );
+    debug("Template ERROR: " . Template->error. "\n") if(!$tt);
+    $tt || die "Failed to initialize Template object: ".Template->error;
 
-    $tt->process(
+    my $ttproc = $tt->process(
         $file,
         { schema => $scma , %$tt_vars },
         \$out
-    ) or die "Error processing template '$file': ".$tt->error;
+    );
+    debug("ERROR: ". $tt->error. "\n") if(!$ttproc);
+    $ttproc or die "Error processing template '$file': ".$tt->error;
 
     return $out;
 };