Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Session Management in CGI::Application

by Anneq (Vicar)
on Nov 15, 2004 at 00:01 UTC ( [id://407739]=note: print w/replies, xml ) Need Help??


in reply to Session Management in CGI::Application

Perhaps try something like this in your cgiapp_prerun():

sub cgiapp_prerun { my $self = shift; # Make CGI params avail my $q = $self->query(); # Open existing session (from cgi cookie id) or open new session my $session = new CGI::Session(undef, $q, {Directory=>'tmp'}); $session->expire('+1h'); # Set Cookie containing session id my $cookie = $q->cookie(CGISESSID => $session->id); # C::A method to send send HTTP properties directly to CGI.pm head +er $self->header_props(-cookie => $cookie); # Reset some session, C::A, & CGI params if user just logged out if ($q->param('rm') eq 'logout') { $session->param('logged_in' => 0); $self->prerun_mode($self->param( 'default_rm')); # Reset other params } # Make session params available to other subs & modules $self->param(session => $session); }

Anne

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://407739]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-03-28 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found