http://qs321.pair.com?node_id=603628


in reply to Re^2: CGI::Ajax + Template::Toolkit Question
in thread CGI::Ajax + Template::Toolkit Question

Rather than passing the configuration variables in $config to process, as chargrill noted, you can specify these when creating the $tt object:
my $config = { INCLUDE_PATH => '/tt', INTERPOLATE => 1, POST_CHOMP => 1, PRE_PROCESS => 'header', EVAL_PERL => 1, }; my $tt = Template->new($config);
and then specify the variables you want processed in your template in process:
sub main_page { my $output = ''; my $template = 'main.tt'; my $vars = { title =>'AJAX Login'}; $tt->process($template, $vars, \$output) || die $tt->error(); return $output; }