Mailing List Archive

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

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;

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 with 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 value AFTER.

Conclusion : $udat doesn't persist.

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>


db
Re: $udat{VALID}[3] persistent and $udat{VALID}[7] isn't. [ In reply to ]
add:

$udat[COUNTER]++;

to your embperl program.

something has to change at the first level of the udat hash for it
to register for storage. i use a counter in mine for that purpose.
you could also use a timestamp or something similar.


___cliff rayman___www.genwax.com___cliff@genwax.com___

Dominique Blas wrote:

> Hi,
>
> 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;
>
> 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 with 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
> value AFTER.
>
> Conclusion : $udat doesn't persist.
>
> 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>
>
>
> db