Loading ...
Sorry, an error occurred while loading the content.
 

RE: handler object: data sometimes resetting

Expand Messages
  • Frank Maas
    ... The address that is returned is an address in the memory space of the running perl interpreter. If you start two interpreters with the same process, then
    Message 1 of 5 , Sep 28, 2005
      > Thanks, Frank, thanks, Damyan, for your answers.
      >
      > I've add testing info to my script, as you recommend:
      >
      > Editing: [2612]8068957.60529976$self current=0
      > Editing: [2613]8068957.60529976$self current=0
      > Editing: [2614]8068957.60529976$self current=0
      > Editing: [2614]8068957.60529976$self current=1
      > Editing: [2614]8068957.60529976$self current=2
      >
      > So, you were right, it's different processes. So, i have more
      > questions about it:
      >
      > 1) Why the address of object is the same, but it has different
      > values? I can't imagine, how this could be.. Where can i find more
      > info about it?

      The address that is returned is an address in the memory space of
      the running perl interpreter. If you start two interpreters with the
      same process, then there is a very good chance that the address is
      the same. The address is not an absolute address pointing towards a
      shared memory location!

      > 2) How can i avoid such problem (i mean not
      > reconfigure apache to use 1 process, just write correct Perl script
      > to store data between processes). I want, as example, "edited" field
      > to be increasing on each request regardless of the process which
      > handle this request.

      What you are looking for is sharing data between processes. Using
      Google or the archives of this mailinglist
      (http://marc.theaimsgroup.com/?l=apache-modperl&r=1&w=2#apache-modperl)
      should give you enough information. I've seen proposed solutions with
      memcached, IPC, a special session, some kind of shared memory, a database
      table and more.

      Good luck!

      Frank
    Your message has been successfully submitted and would be delivered to recipients shortly.