Apache::Session::MySQL won't save session state.
Apache::Session::File returns the following error:
Insecure dependency in open while running with -T switch at
/usr/local/lib/perl5/site_perl/5.6.0/Apache/Session/Lock/File.pm
line 40.
here's the code in question:
sub put_or_del_session {
my ($self, $r, %session) = @_;
if ($self->command eq 'logout') {
tied{%session}->delete;
my $cookie = Apache::Cookie->new( $r,
-name => 'SessionID',
-path => $self->{uri},
-domain => $self->{config}->{TicketServerName},
-expires => '-10m',
-value => '' );
$cookie->bake;
} elsif (($self->page eq 'frame' && $self->command eq 'make') or
$self->page eq 'action') {
$session{state} = $self->{state};
$session{timestamp} = time;
}
$r->log_error("put_or_del_session: session_id is $self->{session_id}");
$r->log_error("put_or_del_session: state is " . Dumper $session{state});
undef %session;
}
sub get_session {
my ($self, $r) = @_;
my %session;
my $cookie_str = $r->header_in('Cookie');
my %cookies = $cookie_str eq '' ? ( ) :
Apache::Cookie->parse($cookie_str);
if (exists $cookies{SessionID}) {
my $session_id = $cookies{SessionID}->value;
# tie %session, 'Apache::Session::MySQL', $session_id,
# {
# DataSource => $self->{config}->{Session_DB},
# UserName => $self->{config}->{Search_DB_User},
# Password => $self->{config}->{Search_DB_Password},
# LockDataSource => $self->{config}->{Session_DB},
# LockUserName => $self->{config}->{Search_DB_User},
# LockPassword => $self->{config}->{Search_DB_Password},
# };
tie %session, 'Apache::Session::File', $session_id,
{
Directory => '/tmp/apache/session',
LockDirectory => '/tmp/apache/session/lock'
};
} else {
# tie %session, 'Apache::Session::MySQL', undef,
# {
# DataSource => $self->{config}->{Session_DB},
# UserName => $self->{config}->{Search_DB_User},
# Password => $self->{config}->{Search_DB_Password},
# LockDataSource => $self->{config}->{Session_DB},
# LockUserName => $self->{config}->{Search_DB_User},
# LockPassword => $self->{config}->{Search_DB_Password},
# };
tie %session, 'Apache::Session::File', undef,
{
Directory => '/tmp/apache/session',
LockDirectory => '/tmp/apache/session/lock'
};
$session{state} = {
account => {},
command => '',
step => '',
order => {}
};
my $cookie = Apache::Cookie->new( $r,
-name => 'SessionID',
-path => $self->{uri},
-domain => 'www.physemp.com',
-value => $session{_session_id} );
$cookie->bake;
}
$self->{state} = $session{state};
$self->{session_id} = $session{_session_id};
$r->log_error("get_session: session_id is $self->{session_id}");
$r->log_error('get_session: $session{state} is ' . Dumper
$session{state});
$r->log_error('get_session: $self->{state} is ' . Dumper $self->{state});
return %session;
}