Hi.

I have a set of files that I'd like to generate with ttree. All of the
templates will need a set of variables that's generated by another
perl-program. So I was wondering what's the best way of making these
variables available for the templates that'll use them.

At the moment, I'm simply using Data::Dumper to save the datastructure
from the first program, then I've set up a template that looks like this:

[% RAWPERL %]

my $vars = do 'variables.pl';
while (my ($key, $val) = each %$vars) {
    $stash->set($key, $val);
}

[% END %]

then I'm calling ttree with --pre_process=variables.tt and --eval_perl

This works fine, so I don't really have to change it, but I was
wondering if there's a better way. Preferably one that doesn't require
eval_perl to be turned on.

Thanks.

-- 
Trond Michelsen

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to