Hi all,
I'm new to the list (and Mason - which by the way, is awesome). I have
a couple of questions about session and cookie handling. I could seem
to find any cookie-cutter recipes out there that worked on my setup
(Apache2,mod_perl2,latest Mason) so I thought I'd ask here. I'm just
trying to bash this together and haven't dealt with sessions or
cookies in Mason before.
In my httpd.conf:
PerlModule HTML::Mason::ApacheHandler
<LocationMatch "/madmin.*\.html$">
PerlSetVar MasonDeclineDirs 0
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
PerlAddVar MasonAllowGlobals $session %cookies $sid
</LocationMatch>
in my index.html:
<%perl>
my $cookie = $r->headers_in->{Cookie} || '';
use CGI::Session;
use CGI::Cookie;
use Data::Dumper;
our %cookies = fetch CGI::Cookie;
our $sid = $cookies{'CGISESSID'} || undef;
our $session = new CGI::Session('Driver: File', $sid, {Directory=>'/tmp'});
if ( !$cookies{'CGISESSID'} ){
$cookie = new CGI::Cookie(-name => 'CGISESSID',
-value =>$session->id(),
-path => '/',);
$r->headers_out->add('Set-Cookie' => $cookie);
}
</%perl>
<....bunch of html ..>
%print "<pre>".Dumper($session)."</pre>\n";
<...more html ...>
When I output $session via Dumper I always get $VAR1=undef. Can anyone
point me at what I'm doing wrong, or point me at a cookie-cutter
recipe that works?
--Aaron
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users