mwhiting has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl monks. I have a quandry about ActivePerl on Windows NT, and CGI::Session. I have a script that is supposed to do a simple task: create a session file in a folder on NT and store a value in it. Then I can retrieve the value later in a second call to the script. This is intended to be done in an internet browser, but for now I'm just using the NT command prompt to debug. Here's the script:
As it is, no file is created in the 'd:/web/libsearch' folder. If I use#!/usr/bin/perl use CGI; use CGI::Session; use CGI::Carp qw(fatalsToBrowser); $cgi = new CGI; $sid = $cgi->param('CGISESSID') || undef; $destdir = 'd:\web\libsearch'; $session = new CGI::Session("driver:File", $sid, {Directory=>$destdir} +) or die CGI::Session->errstr(); $sid = $session->id(); print "<br>sid=$sid, $destdir\n"; #store the variable $testvalue = "abc"; $session->param("testvar", $testvalue); $session->save_param($cgi); #retrieve the variable $retrieved = $session->param("testvalue"); print "<br>retrieved:$retrieved \n"; exit;
$destdir = File::Spec->tmpdir;instead of a hardcoded folder, I get the logged-in temp folder for administrator (which is how I am logged in), and the file is created & all is good. The hardcoded folder has 'everybody' listed for permissions, so it shouldn't be a permissions issue.
If I compile it into an exe (with Perl2Exe - any comments on that?) and run it from a webbrowser like I intend to do eventually here, it uses c:\winnt\temp as the temp folder value, and still no file gets created. (also no file with the hardcoded value).
Why is it unable to create a file in some circumstances? My permissions don't seem to be a problem, so what is happening in CGI::Session that it doesn't like the other folder? Thanks in advance! Michael
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI Session - not creating session file
by Joost (Canon) on Aug 02, 2007 at 20:11 UTC | |
by mwhiting (Beadle) on Aug 03, 2007 at 12:58 UTC | |
|
Re: CGI Session - not creating session file
by oxone (Friar) on Aug 02, 2007 at 20:04 UTC | |
|
Re: CGI Session - not creating session file
by whereiskurt (Friar) on Aug 02, 2007 at 20:07 UTC |