in reply to Re: Template Toolkit: Output one template to Sendmail, another to browser?
in thread Template Toolkit: Output one template to Sendmail, another to browser?

The way the process method works always annoyed me, so I wrote a little wrapper around it (the $template object needs to be global in this version):
sub parse_template($;$) { my $filename = shift; my $vars = shift || {}; my $parsed; $template->process($filename, $vars, \$parsed) or die 'Couldn\'t o +pen template: ' . $template->error(); return $parsed; }
  • Comment on Re^2: Template Toolkit: Output one template to Sendmail, another to browser?
  • Download Code