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',
},
},
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
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 initialize the Template object by
-adding a tt_conf producer_arg. See Template Toolkit docs for details of
+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).
to => 'TT',
producer_args => {
ttfile => 'foo_template.tt',
- ttargs => {},
- tt_conf = {
+ tt_vars => {},
+ tt_conf => {
INCLUDE_PATH => '/foo/templates/tt',
INTERPOLATE => 1,
}
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";