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
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to