Re: [Templates] mod_perl + cookies + TT2 process = my problem

[prev] [thread] [next] [Date index for 2004/12/13]

From: Harry Jackson
Subject: Re: [Templates] mod_perl + cookies + TT2 process = my problem
Date: 15:18 on 13 Dec 2004
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

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] mod_perl + cookies + TT2 process = my problem
Harry Jackson 15:18 on 13 Dec 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52