I think this is expected behaviour. CGI is reading the cookie that is sent
by the client. You are outputting the cookie in your PerlInitHandler which
gets sent back to your client browser with the response from the web server.
CGI has no knowledge that the cookie has changed until your browser makes
another request and sends the new value of the cookie.
I suppose that in order to help further we need to understand what you are
trying to achieve, but in essence it is not a template toolkit problem.
Regards
Sam
-----Original Message-----
From: Jon Ross [mailto:jon.ross-TdJ60t9Ux7AqdlJmJB21zg@xxxxxxxxxxxxxxxx]
Sent: 22 June 2003 20:23
To: templates-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@xxxxxxxxxxxxxxxx
Subject: [Templates] Processing Cookies in TT
First - I apologise if the problem I am having is not relevant to TT but
mod_perl, as I have said previously - without knowing what the problem is it
is difficult to know where the problem is.
The problem :
I have an PerlInitHandler which uses Apache::Cookie to set/update a cookie
value, but [% USE CGI %] always shows the cookie in it's state before the
last change.
e.g.
# in PerlInitHandler
# Get a counter from cookie and increment
$counter = $counterFromCookie + 1; <--- The cookie is correct I've
checked the file
my $session_cookie = Apache::Cookie->new($r,
-name => "counter",
-value => $counter,
-path=> "/",
-expires =>"+10d"
);
$session_cookie->bake();
# Continue to Handler
In template :
[% USE CGI %]
<p>The value is [% CGI.cookie('counter') | html %]
First pass - The value is
(cookie file contains :
counter
1
#etc)
Second pass = The value is 1
(cookie file contains :
counter
2
#etc)
So either the cookie is being read before the changes.
I have tried adding :
$r->err_headers_out->add('Set-Cookie' => $session_cookie);
to the PerlInitHandler but the outcome is the same.
_______________________________________________
templates mailing list
templates-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@xxxxxxxxxxxxxxxx
http://lists.template-toolkit.org/mailman/listinfo/templates
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|