Wolfie7873
Technical User
Trying to do some session management. Have this:
Currently, this dies at the first if block with:
Any clues? I've been through Apache::Cookie, Apache2::Cookie and haven't had ANY success writing a freaking cookie yet.
Code:
{ package HTML::Mason::Commands;
use vars qw(%session);
use CGI::Cookie;
use Apache::DBI;
use Apache::Session::MySQL;
}
# Get the incoming cookies
my %cookies = CGI::Cookie->fetch or die "could not fetch CGI::Cookie";
# Try to re-establish an existing session
eval {
tie %HTML::Mason::Commands::session, 'Apache::Session::MySQL',
($cookies{'AF_SID'} ? $cookies{'AF_SID'}->value() : undef),
{
DataSource => $dsn,
UserName => $user,
Password => $pwd
} or die "could not tie existing session" . $!;
};
# If we could not re-establish an existing
# session, create a new session.
if ( $@ ) {
print "there was an error" . $@;
if ( $@ =~ m#^Object does not exist in the data store# ) {
tie %HTML::Mason::Commands::session,
'Apache::Session::MySQL',
undef,
{
DataSource => $dsn,
UserName => $user,
Password => $pwd
};
undef $cookies{'AF_SID'} or die "could not tie new session" . $!;
}
}
if ( !$cookies{'AF_SID'} ) {
my $cookie = CGI::Cookie->new($r,
-name => 'AF_SID',
-value => $HTML::Mason::Commands::session{_session_id},
-path => '/',
-domain => 'tarheeloesrescue.org',
);
$cookie->bake or die "could not bake cookie" . $!;
}
my $session = \%session;
Code:
Died at /var/[URL unfurl="true"]www/html/lib/Apache/Session/Generate/MD5.pm[/URL] line 40.
Stack:
[/var/www/html/lib/Apache/Session/Generate/MD5.pm:40]
[/var/www/html/lib/Apache/Session.pm:414]
[/var/www/subdomains/test/html/autohandler:139]
Any clues? I've been through Apache::Cookie, Apache2::Cookie and haven't had ANY success writing a freaking cookie yet.