On Thu, 2003-10-16 at 16:42, Simon Dassow wrote: > I want to have %session to be shared in a module. > With ``use vars qw(%session);'' it doesnt seem to work (Apache is blocking > after a few requests).
This is probably because Apache::Session locks until it gets destroyed, and globals never get destroyed. > My current solution is to store the reference via > ``$r->pnotes("SESSION_DATA"=>\%session);'' and save $r into $self so the other > methods > have access. But i think i could be made better, but i've no idea how, maybe > someone of you can help me with that. Are you just trying to share it with other code during the same request? What you're doing is fine. You can also always gets the current request object by calling Apache->request(). > The main thing i dont understand is why i cant use vars... You can, but you would have to manually clear the global at the end of the request so that the session object gets DESTROYed, saves your changes, and releases locks. > package My::Home; > use strict; > use Data::Dumper; > use Apache::Session::Flex; > use Apache::Request; > use Apache::Constants qw(:common); > $My::Home=bless({}); That last part is strange. It's assigning a hash, blessed into My::Home, to a global called $Home in the package My. I doubt that's really what you want to do. > sub handler { > my($self,$r)[EMAIL PROTECTED]; There is only a $self here if you've set this handler up as a method handler and prototyped it correctly. See http://perl.apache.org/docs/1.0/guide/config.html#Perl_Method_Handlers Have you checked to see what you're getting in $self and $r? - Perrin