in reply to Template Toolkit: Output one template to Sendmail, another to browser?
This is what process is supposed to do, from docs:$template_1->process($template_file, $vars) || die "Template process failed: ", $template->error(), "\n"; &send_mail_html($email, $from_address, $subject, $template_1); $template_file = 'confirm_contact_info_email.htm'; $template->process($template_file, $vars) || die "Template process failed: ", $template->error(), "\n";
By default, the processed template output is printed to STDOUT. The process() method then returns 1 to indicate success. A third parameter may be passed to the process() method to specify a different output location. This value may be one of: a plain string indicating a filename which will be opened (relative to OUTPUT_PATH, if defined) and the output written to; a file GLOB opened ready for output; a reference to a scalar (e.g. a text string) to which output/error is appended; a reference to a subroutine which is called, passing the output as a parameter; or any object reference which implements a 'print' method (e.g. IO::Handle, Apache::Request, etc.) which will be called, passing the generated output as a parameter.
So when you send template1 to send_mail you're actually sending a blessed template object (hash). And, your double output is presumably the confirmation screen reading from STDIN, (which your writing to twice, because your not sending process a third var)
On top of that
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Template Toolkit: Output one template to Sendmail, another to browser?
by punch_card_don (Curate) on Aug 26, 2007 at 13:47 UTC | |
by clscott (Friar) on Aug 26, 2007 at 17:33 UTC | |
by punch_card_don (Curate) on Aug 27, 2007 at 01:03 UTC | |
|
Re^2: Template Toolkit: Output one template to Sendmail, another to browser?
by Cap'n Steve (Friar) on Aug 27, 2007 at 01:45 UTC |