in reply to Persistency issues with tied hashes

I had great problems with this at one point. I can't remember the details, but I see in my working code I am attempting the tie twice - once wrapped in an eval block supplying a SID and once supplying undef explicitly (if the fetch with SID failed).

Perhaps Apache::Session is being weird because it's not getting undef but the empty string or something like that. See if the session ID is actually being remembered, investigate what is going into the temporary files. And untie %session as early as possible, definitely before you ->process the template.

  • Comment on Re: Persistency issues with tied hashes

Replies are listed 'Best First'.
Re: Re: Persistency issues with tied hashes
by rob_au (Abbot) on Jul 31, 2002 at 15:07 UTC
    It sounds like you and I investigate along similar trains of thought :-)

    The puzzling thing about this problem from my perspective was that the session ID was being stored between run-levels ruling out such issues as file system permissions or limitations of the perlfunc:tie interface itself.

    Based upon your suggestion to untie the %session hash prior to the processing of the Template object however, I modified my code accordingly and found that this fixed my problem. From a summary review of the code, I suspect that the issue lies within the localise method of Template::Context which is called from the Template::Service instance to manipulate the passed argument hash - I will however dig further into this once I get a bit more time on my hands.

    Thanks again for your help mugwumpjism++

     

      Apache::Session does some scary things with persistence. In particular, it maintains an exlusive lock on the session data until the hash gets destroyed, which can mean that every other request for this session (including images if you aren't careful) will wait. The hash will not get destroyed while there is any existing reference to it. That's probably what's tripping you up.

      If you really want to use Apache::Session rather than something simpler like MLDBM::Sync, I suggest you treat it as a hot potato, i.e. create the hash, get what you want in and out of it as fast as you can, and get rid of it immediately. Don't leave it hanging around while you do other stuff.