Hi monks. I have script that uses a session file to save a password, and then can reread it on subsequent calls (in a browser, not from command line). This works fine on Linux, but doesn't work on Windows (compiled with Perl2exe, not pp, sorry, bear with me, shouldn't have anything to do with it)
Here is the script:
The script works to put a session file with the pwd content into \windows\temp. But on a subsequent call, with &CGISESSID=xxxxxxxxxxx added to feed it the session id, it doesn't pay any attention to the session file that it created on the last run, and creates a new one each time instead.#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); print "Content-type: text/html;charset=UTF-8\n\n"; print "<html><head></head><body>Start test script.<br><br>\n"; use CGI; use CGI::Session; $cgi = new CGI; $sid = $cgi->param('CGISESSID') || undef; print "Incoming sid:$sid<br>"; $SessionFilePath = 'c:\windows\temp'; $session = new CGI::Session("driver:File", $sid, {Directory=>$SessionF +ilePath}) or die CGI::Session->errstr(); $sid = $session->id(); $pwd = "test"; $session->param("pwd", $pwd); $session->save_param($cgi); $session->flush(); print "<br>sid is now $sid.\n"; exit;
As I said it works on Linux. I'm thinking there is a file permission problem in Windows, but I don't know what it would be or where to start looking. (I do have admin access to the server though)
I'm using \windows\temp because an outside http request didn't have permissions to create files in other places, but it worked to create the file there. That can be setup, but I thought this should work in \windows\temp. Your insights are greatly coveted. Thank-you.
In reply to CGI::Session on Windows, can't reread file by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |