in reply to Re: Dynamic variable naming in Template Toolkit
in thread Dynamic variable naming in Template Toolkit

How is TT being invoked?

I could override the method that invokes the template for me (I'm using CGI::Prototype) but I'd rather not.

why not try and pre-populate a hash instead of using symbolic references?

That's actually what I'm doing... to start at least. There is already a large data structure being passed into the template. I'm adding an extra key to the data structure with all of the additional variables I need as keys. Then in the template, I want to turn those into simple scalar variables. Something like this:

$ds->{for_template}->{this_key} = 'foo'; $ds->{for_template}->{that_key} = 'bar';

Where $ds is the data structure that is already being passed into the template. Then in the template (in perl for now):

for my $var ( keys %{ $ds->{for_template} } ){ ${eval $var} = $ds->{for_template}->{$var}; }

Basically, I want to flatten the hash into individual variables that the template is expecting to be defined.

perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'