Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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


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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2015-11-25 13:25 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (675 votes), past polls