Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Session Management in CGI::Application

by Anneq (Vicar)
on Nov 15, 2004 at 00:01 UTC ( #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


Comment on Re: Session Management in CGI::Application
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2015-07-05 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls