[Maypole] Problems with sessions [Solved]
Peter Speltz
peterspeltz@yahoo.com
Fri, 4 Feb 2005 10:28:11 -0800 (PST)
--- Marcello <m.romani@spinsoft.it> wrote:
> Marcello ha scritto:
>
> The problem was I was not familiar with tied references...
>
> I changed my code to modify the session this way:
> get a reference to the session variable
> my $a=$r->{session}->{constraints}
> modify the session variable
> $a->{customer} = 4
> store the modified session variable into the session
> $r->{session}->{constraints} = $a
> This ensures the changes to the session are saved.
>
> Marcello
>
That's right. Apache::Session only looks in the top level for changes when
deciding whether to write session or not. So it was looking at the constraints
hash ref and not seeing any change (its still hash at same address) and it
doesn't look down in the hash for changes.
Another way to do it is to timestamp the session every time you update it as
mentioned in Apache;:Session manual.
$r->session->{timstamp} = localtime;
or what not.
=====
pjs
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com