perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derrick Spell <derricksp...@cdmplus.com>
Subject Re: Array of Hashes in %udat
Date Mon, 10 Jan 2005 21:21:13 GMT

On Jan 10, 2005, at 2:27 PM, RobertCZ wrote:

> Derrick Spell wrote:
>
>> I have an array of hashes that I would like to store in %udat.  First 
>> of all, is this possible?  Second, what is the correct syntax.  I 
>> have tried:
>>
>> $udat{AoH} = @AoH;
>>
>> but the array doesn't seem to be there when I try to retrieve it.
>
> You cant put array there, just an array ref.
>
> $udat{AoH} = [ @AoH ];
>
> works, or maybe
>
> $udat{AoH} = \@AoH;

This makes sense, although I was still having trouble retrieving the 
reference from $udat on the next page.  After I ran several tests it 
almost seemed that each Apache child had it's own copy of my data 
structure.  It turns out that I didn't have Apache::SessionX configured 
correctly.  Once I got that working correctly, I started seeing the 
output I expected.  Many thanks for your insight!

>
> PS Dont forget %udat will NOT notice deep change eg if you change 
> something inside one of the hashes, you have to force session save 
> with some top-level change maybe something like $udat{changed}++ etc

Yeah, I'd seen something about that in the archives.  I'm using the 
$udat{time} = time; trick to ensure my data will be saved.


-Derrick



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message