use Apache2::Request; use Apache::Session::File; use warnings; #read cookie if this is an running session my $r = Apache2::RequestUtil->request; my $cookie = $r->headers_in('Cookie'); #Create a session object based on the cookie my %session; tie %session, 'Apache::Session::File', $cookie, { Directory => '/tmp/plsessions', LockDirectory => '/tmp/plsessionlock', }; # if a new session, give it cookie back my $session_cookie = "SESSION_ID=$session{_session_id};"; $r->headers_out("Set-Cookie" => $session_cookie);