On Tue, Oct 21, 2008 at 04:07:13AM -0700, Jonathan Swartz wrote: > Are you using the MasonX session package, or something hand-rolled? > Personally I like CGI::Session for handling sessions, and it will take > care of expiration for you.
I tried using MasonX for some time but it stopped working at some point with perl-5.10 (see attached previous post to this list). Now it's fixed but I still kept my hand-rolled system, which was provided with mason in an old handler.pl example: my %cookies = CGI::Cookie->fetch($r); eval { tie( %HTML::Mason::Commands::session, 'Apache::Session::Postgres', ($cookies{AF_SID} ? $cookies{AF_SID}->value() : $ENV{AF_SID}), { Handle=>$dbs},); }; if ($@ =~ m#^Object does not exist in the data store#) { # If the session is invalid, create a new session. tie(%HTML::Mason::Commands::session, 'Apache::Session::Postgres', undef, {Handle=>$dbs}); undef $cookies{AF_SID}; } if (!$cookies{AF_SID}) { my $cookie = new CGI::Cookie( -name=>'AF_SID', -value=>$HTML::Mason::Commands::session{_session_id}, -expires=>"+10y", -path => '/',); $cookie->bake($r); } I am now considering CGI::Session, following your suggestion. Thanks, > On Oct 21, 2008, at 3:35 AM, Louis-David Mitterrand wrote: > >> Hi, >> >> I have just added some code in my handler.pl to expire idle sessions >> after 1 hour and thought I'd submit it to the list for review. The >> 'critik' $session key contains all login details. >> >> my $m = $ah->prepare_request($r); >> >> my $status = $m->exec; >> >> my $time = time(); >> if ($time - $HTML::Mason::Commands::session{TIMESTAMP} > 3600) { >> delete($HTML::Mason::Commands::session{critik}) >> } >> $HTML::Mason::Commands::session{TIMESTAMP} = $time; >> >> >> untie %HTML::Mason::Commands::session; >> >> return $status; >> >> Is that the best way to do it? >> >> Thanks, >> >> -- >> http://www.lesculturelles.net >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Mason-users mailing list >> Mason-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/mason-users >> > -- http://www.lesculturelles.net
--- Begin Message ---Hi, After upgrading to perl 5.10 I get a modperl segfault when using MasonX::Request::WithApacheSession. Apparently it can be reduced to this one-liner: perl -e '@ISA = 'Foo'; $ISA[$_] = 'Bar' for (0..$#ISA);' which crashes perl. The debian bug report is at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=480480 Before trying to dig into the module's innards, I tought I'd ask around the list for any known workaround. Thanks,
--- End Message ---
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users