Harry Jackson wrote:
Tosh Cooey wrote:
Hi, I have the following program running under mod_perl:
program.pl ********** do stuff... my $sitewide = new SITEWIDE; more stuff... $template->process($page, $vars); END
SITEWIDE.pm *********** stuff... my $cgi = new CGI; my $cookie = $cgi->cookie(-name=>'UID'); &set_cookie if (!$cookie); stuff...
In "program.pl" there is no "Content-type:" header sent in the CGI but it's rather in the template, that way each template has control over it's own header.
If a user hits "program.pl" and they *don't* have a cookie then one is set, BUT then the output of program.pl isn't sent as rendered HTML but as text, ie. the user sees this:
This may be wrong but what way are you sending the header. if its a plain piece of text in the template then mod_perl will ignore it and guess the mime type which in your case is text. If you use the CGI module from withing the template to call its header method them the CGI module should detect mod_perl and handle it properly.
"Parctical mod_perl: Oreilly" has some stuff on this. Have a look at Chapter 6
This would seem to be the case, and Chapter six says:
"The PerlSendHeader On directive tells mod_perl to intercept anything that looks like a header line (such as Content-Type: text/plain) and automatically turn it in to a correctly formatted HTTP header, much like CGI scripts running under mod_cgi. This feature allows you to keep your CGI scripts unmodified. "
I'm using mod_perl2 and have PerlOptions +ParseHeaders set which I assume is the same.
Any idea why the output from TT2's "process" call isn't intercepted while a standard print "Content-type: text/html\n\n;" is? Is the output redirected to <STDOUT> rather than via 'print' ?
And of course is there an elegant way of sending headers per individual template?
Tosh
-- McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
