Hi Pe(rlers|ople),
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).
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.
Perhaps i'm totally wrong, but i didn't find any comments on that and the
mod_perl-book needs a few weeks until it arrives :(.
The main thing i dont understand is why i cant use vars...
Thanks in advance,
Regards,
Simon
The code im using:
package My::Home;
use strict;
use Data::Dumper;
use Apache::Session::Flex;
use Apache::Request;
use Apache::Constants qw(:common);
$My::Home=bless({});
sub handler {
my($self,$r)[EMAIL PROTECTED];
my $apr=new Apache::Request($r);
$self->{$r}=$r;
my $sid=$apr->param("SID")||undef;
my %session=();
tie %session, 'Apache::Session::Flex',$sid {..... and so on
$r->pnotes("SESSION_DATA"=>\%session);
$r->content_type("text/html");
$r->send_http_header();
$self->debug_session();
return(OK);
}
sub debug_session {
my $self=shift;
my %session=$self->{r}->pnotes("SESSION_DATA");
print "<pre>";
print Dumper(\%session);
print "</pre>";
}