Apache::Session only does a shallow check of your data structure to see if
it needs to update the database. If you are only changing values deep
inside a hash structure, A::S will not see the changes, and they will not
be saves. The man page recommends adding a timestamp to the tied hash and
updating that on every request (ie $s{_timestamp} = time;).
Cees
On Tue, 22 May 2001, Chris Thompson wrote:
> I'm at wits end, I'm hoping someone can tell me what's wrong.
>
> This is Apache 1.3.19, Redhat 6.2, modperl 1.25, apache::session 1.53
> and MySQL 3.23.36.
>
> (This is also happening inside HTML::Mason 1.03, but I dont think that has
> anything to do with it. I've crossposted to the mason list in case anyone
> there has seen this behavior, but what I'm doing isnt really out of the
> ordinary, so I dont think it's Mason related)
>
> I've got a hash %s successfully re tied every request. I'm using it to store
> a session id and userid with success, so I know it's storing.
>
> Maybe I'm doing too much for A::S but here goes.
>
> I want an entry in the %s hash that is an array of hashrefs
>
> so tied-hash -> array -> hash.
>
> I'm writing this in wizard style, getting one piece of information from the
> client per page. The first step is to get a list of domain names, which I do
> and store in @domain.
>
> then I do
>
> my $c=0;
> foreach my $dom (@domain) {
> my $ref = { 'domainname' => $dom,
> 'term' => '',
> 'ns1name' => '',
> 'ns1ip' => '',
> 'ns2name' => '',
> 'ns2ip' => ''
> };
> $s{regdomains}->[$c++] = $ref;
> }
>
> this data is all successfully stored in the session.
>
> We now move to the second page, and if I do a Data::Dumper on %s, I can
> actually see the above structure as I envisioned it.
>
> (I'll paraphrase here and not paste the whole dump)
>
> 'regdomains' => [
> {
> 'ns1name' => '',
> 'ns2ip' => '',
> 'domainname' => 'qwert.com',
> 'term' => '2',
> 'ns2name' => '',
> 'ns1ip' => ''
> },
>
> Note that 'term'=> '2'.
>
> That's there because before I did the Dumper, I populated the %s with the
> data I had on the term. Each term is read from Apache::Request into
> @term. (Yes, the orders match)
>
> so I do...
>
> my $c=0;
> foreach my $term (@term) {
> $s{regdomains}->[$c++]->{term} = $term;
> }
>
> Then I do the Dumper. You can see the result above. Term is set, and I've
> verified by changing the term per domain name that the data is going in
> correctly.
>
> Now, as I understand it, the tie is causing any data written into the hash
> to be written to the database.
>
> The problem is that it's not. When I get to my third page I get four fields
> per domain for the nameservers and assign into the hash with...
>
> my $c=0;
> foreach (@{$s{regdomains}}) {
> $s{regdomains}->[$c]->{ns1name} = $nsn1[$c];
> $s{regdomains}->[$c]->{ns1ip} = $nsip1[$c];
> $s{regdomains}->[$c]->{ns2name} = $nsn2[$c];
> $s{regdomains}->[$c]->{ns2ip} = $nsip2[$c];
> $c++;
> }
>
> I then do a Dumper and get...
>
>
> 'regdomains' => [
> {
> 'ns1name' => 'a',
> 'ns2ip' => 'd',
> 'domainname' => 'qwert.com',
> 'term' => '',
> 'ns2name' => 'c',
> 'ns1ip' => 'b'
> },
>
> you'll see that term is now empty. I've watched the db, and reading it's
> cryptic scrawl, I never see any entries for term.
>
> HELP!
>
>
>
--
Cees Hek
SiteSuite Corporation
[EMAIL PROTECTED]