Mailing List Archive

RE: $udat{VALID}[3] persistent and $udat{VALID}[7] isn't.
Hi,

Sorry to send thhis email directly to you but I can't see it appearing on
the embperl mailing-list.


Maybe you are not subscribed to the list?

Here is the pb :

At the end of this mail you can find a small piece of code that does only
one thing : put a one in the 8th row of a scalar table pointed by the $udat
hash table.
That is : $udat{VALID}[7]=1;



Apache::Session only writes back the changed content of %udat, if it's
changed on the first level of indirection. So your changes will only persist
if you do a

$udat{CNT}++

but not if you do

$udat{VALID}{CNT}++

To solve your problem, simply update a direct element of %udat, like in the
first example, if you have changed anything

Gerald

-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------



And the display thereafter is the scan of the values of this table
indexed from 0 to 9 BEFORE and AFTER the input.

As you can see index 7 is correctly filled in with value 1 after the
input.


But if I reload my page the results stay the same. That is : no value 1 in
the table at the 8th position BEFORE the assignation and a 1 AFTER.


Conclusion : $udat doesn't persist.

But it's not that simple ! therefore you can see that it worked with the
index 3 : $udat{VALID}[3] is persistent but $udat{VALID}[7] is not !!!


Can you find an explanation ?

Thank a lot,

db
Result
------
HELLO

A : BEFORE
0 ==>
1 ==> 0
2 ==>
3 ==> 1
4 ==>
5 ==>
6 ==>
7 ==>
8 ==>
9 ==>
AFTER
0 ==>
1 ==> 0
2 ==>
3 ==> 1
4 ==>
5 ==>
6 ==>
7 ==> 1
8 ==>
9 ==>

Piece of code
-------------
<html>
<head>
</head>
<body>
HELLO

<pre>
[.-
$flag=0;
$A.="BEFORE\n";
for ($i=0; $i<=9; $i++) {
$A.="$i ==> $udat{VALID}[$i]\n";
}


$udat{VALID}->[7]=1;

$A.="AFTER\n";

for ($i=0; $i<=9; $i++) {
$A.="$i ==> $udat{VALID}[$i]\n";
}
-]

A : [+$A+]

</body>
</html>


Best,

db