Home  |  Linux  | Mysql  | PHP  | XML
From:Brian J. Miller Date:Wed Mar 31 02:21:20 2010
Subject:Re: Saving data to %session with Apache::Session::File
Fabian Gut wrote:
> Hi
>
> I'm using Apache::Session::File for session management. I have a hash in
> $session{'config'} that saves some config values.
>
> I have a script that should change these config values:
>
> foreach ( sort keys %newconfig ) {
> $session{'config'}{$_} = $newconfig{$_};
> }
>
> this works perfectly for the script. However, the values are not written
> to the session file. Thus they are not stored permanently and if I
> reload the script, the old values are in $session again. Does anyone
> know, what might be the reason for that?
>
> Greetings
> Fabian Gut
>

From the Apache::Session docs:

"Note that Apache::Session does only a shallow check to see if anything
has changed. If nothing changes in the top level tied hash, the data
will not be updated in the backing store. You are encouraged to
timestamp the session hash so that it is sure to be updated."

So in your loop you are updating the nested structure under 'config' but
nothing at the top level of the hash. To have it stored you would have
to update a key or value of $session.

HTH,

--
Brian J. Miller
End Point Corp.
http://www.endpoint.com/
brian@endpoint.com
Navigate in group perl.beginners.cgi at sever nntp.perl.org
Previous Next


Your recent visits
problems with 'require'
Re: problems with 'require'
cgi and perl database interaction
Saving data to %session with Apache::Session::File



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants