I recently began using CGI::Application and HTML::Template to make better CGI apps. I started to add Apache::Session::File and to control session data. I currently have an email app and do not want the message body on the URL line when going to the next run mode. I got Apache Session working but when going to the next run mode a new session is created. It seems that sub Setup is running every time the app is called and I don't think that is right?
Does anyone have any thoughts on this?
Todd Cox
NCI Network Support
Rockville, MD
sub setup {
my $self = shift;
$self->start_mode('mode1');
$self->run_modes(
'mode1' => 'showSelectGroup',
'mode2' => 'showSelectGroupEmail',
'mode3' => 'showComposeMessage',
'mode4' => 'showConfirm'
);
$self->tmpl_path("c:/Apache/htdocs/ncimail/");
my @prop;
# Store the properties in a file so it is easily changed.
open(PROP,"c:/apache/prop/ldap.properties") || die "Can't open l
+dap.properties for reading!";
while(<PROP>)
{
chomp;
push(@prop, $_);
}
close(PROP);
my $hostname = $prop[4];
my $search_dn = $prop[5];
my $search_pwd = $prop[6];
my $scope = $prop[7];
my $port = $prop[8];
my $ldap = Net::LDAPS->new($hostname,port => $port,timeout => TI
+MEOUT) or die "Can't connect to LDAP server " . $hostname;
my $result = $ldap->bind($search_dn, password => $search_pwd, ve
+rsion => 3);
my $error = $result->error();
if($error ne "Success")
{
print ("<BR>LDAP Bind Error: $error<br>");
exit;
}
my %session;
my $id;
tie %session, 'Apache::Session::File', $id, {Directory => 'c:/ap
+ache/tmp/sessions', LockDirectory => 'c:/apache/tmp/lock'};
my $session_id = $session{_session_id};
$self->param('session_id' => $session_id);
}