Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

mod_perl2 sessions?

by httpd (Novice)
on Nov 04, 2013 at 17:12 UTC ( #1061159=perlquestion: print w/replies, xml ) Need Help??
httpd has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am new to mod_perl, and I want to manage sessions on my site, however I cannot create it, please help.

I am trying to use Apache::Session::File module, and my code looks like the following:

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);

when trying to run that script from browser I get following in error_log:

[Tue Nov 05 00:01:34 2013] [error] argument is not a blessed reference + (expecting an APR::Table derived object) at scripts/login.pl line 8. +\n

If anybody has a sample example on howto use sessions with mod_perl2, i would appreciate if you share. PS. I was trying to install perl-Apache-SessionManager, however it fails:

~# rpm -Uvh perl-Apache-SessionManager-1.03-1.2.el6.rf.noarch.rpm error: Failed dependencies: perl(mod_perl) is needed by perl-Apache-SessionManager-1.03-1. +2.el6.rf.noarch # rpm -q mod_perl mod_perl-2.0.4-10.el6.x86_64

That's strange because in description perl-Apache-SessionManager supports mod_perl2

Any help kindly appreciated

Replies are listed 'Best First'.
Re: mod_perl2 sessions?
by Anonymous Monk on Nov 05, 2013 at 01:29 UTC
    Well, I doubt $cookie is a sessionid, the kind you're expecting
      do you have any example of creating session with mod_perl2? I cannot find it :(

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1061159]
Approved by marto
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-07-21 14:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (449 votes). Check out past polls.

    Notices?