[Maypole] Problems with sessions [Solved]
Marcello
m.romani@spinsoft.it
Mon, 07 Feb 2005 11:41:23 +0100
Peter Speltz ha scritto:
> --- 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.
Thanks for the reference.
Marcello