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

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

From: Tosh Cooey
Subject: [Templates] mod_perl + cookies + TT2 process = my problem
Date: 14:45 on 13 Dec 2004
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:

      Content-type: text/html

      <?xml version="1.0" encoding="iso-8859-1"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "SNIP">
      <html xmlns="http://www.w3.org/1999/xhtml">;
      <head>
      SNIP

*****This only occurs when running under mod_perl and only when the Content-type 
header is set in the template and so printed during the "process" call rather 
than 'print "Content-type: text/html\n\n";' before the process call.*****

Did I miss the part of the docs which state "Don't do something like that idiot" 
or is there another issue I'm missing?

Thanks!

Tosh
        -- 
        McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/


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

[Templates] mod_perl + cookies + TT2 process = my problem
Tosh Cooey 14:45 on 13 Dec 2004

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