I use apache::session in my application which runs as a handler, and the
session variables are needed by just about every module in the application
(14 modules in all).  Now the problem is that when the application dies
unexpectedly, the session locking leaves a lock on the session file.

I have had the session as a global package variable which I export to other
packages that need to access it, which is the root of my problem.  However
since some of the methods in my modules are called from the template toolkit
via callbacks, it's really difficult to make sure those methods have access
to the session variable without using global variables (making the session
variable an argument to the template page functions is not an option).

Well now what I have is the session variable created by my session module
and it is my scoped.  The module passes back a copy and a reference of the
session hash to my main module. The main module exports the copy of the hash
(but not the reference) globally and at the end of the application execution
I have a cleanup handler that copies the copied hash back to the real
session hash via the reference and then makes sure the reference is
undefined.  Now this does work, the session goes out of scope completely
even if there is a 500 server error and apache::session correctly runs it's
DESTROY method which cleans up the lock file.  It seems like a huge hack to
me though.

Does anyone know of a way to make a copy of a tied hash that is still tied
to the original hash?  And also have it so that the tied copy goes out of
scope when the original hash goes out of scope?  I dont' think this is
possible but thought I would ask.

Chris



-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to