Hi Brendan,

> I'm trying to store an object (simple datatype, just a blessed hash
> inside) within Apache::Session.  I'm doing this:
> $session->{tax_swap}->{preview_sell_candidates} = [EMAIL PROTECTED]; 
> where @items is an array of SellCandidate objects... I've stored array
> references in Apache::Session before; is the problem my trying to save
> the Objects, or the objects within an array Ref?

The problem is most likely that you are storing it two levels deep. 
Apache::Session only saves when it sees that you have changed something,
and it isn't seeing your change.  This is a common problem with tied
objects, and there is a good explanation of it in the MLDBM
documentation.  The Apache::Session docs say this:

"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."

You could also just call the save method explicitly:
tied(%session)->save()

> I know from it's docs that CGI::Session can store Objects - am I better
> off switching to CGI::Session

They both use Storable for serialization.  The problem is the tie, not
the serializer.

- Perrin

Reply via email to