Holy Monks,
I'm trying to use the Template::Toolkit module for a CGI application. Here's the code I use:
my $output = "Content-type: text/html\n\n"; my $file = 'index.html'; my $vars = { title => "Hello World\n" }; my $template = Template->new({ INCLUDE_PATH => 'C:/Apache2/htdocs/gelna/templates' } ); $output .= $template->process($file, $vars) || die "Template process + failed: ", $template->error(), "\n"; print $output;
The ouput from this code is this:
C:\Apache2\htdocs\gelna>perl index.cgi <HTML> <head> <title>This is an HTML example</title> </head> <body bgcolor="#ffffff"> <h1></h1> <hr> <center> © Copyright 2000 Me, Myself, I </center> </body> </html> Content-type: text/html 1
Thus, the HTML header goes after the template output. I can't make it go first. What am I doing wrong here? BTW, in the beginning I tried to use the CGI::Application together with it. And I also couldn't make the header go before the template processing output. The Template::Toolkit seems to process my template well. It's just the header that doesn't work. And the "1" value at the end of the output bothers me too.
Thank you.
In reply to Template::Toolkit + CGI header by Heidegger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |