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);
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|