in reply to Re^4: CGI::Session Compilation Issues
in thread CGI::Session Compilation Issues

CGI::Session likely is installed properly, as your script compiles. As you still didn't provide a self-contained, minimal script that exhibits the behaviour, I can't reproduce your problem. Also, you still keep the value of $perl_directory to yourself, so I can only guess that it is either a relative path, and your webserver does not have the same current directory as you have when you run your script through the shell, or that it is a permission issue and the user your webserver runs as does not have the same permissions as you have on $perl_directory. But then again, you seem bent on blaming this on a CGI::Session compilation issue again and again, so maybe you'll find the solution there.

Replies are listed 'Best First'.
Re^6: CGI::Session Compilation Issues
by rpike (Scribe) on Feb 22, 2010 at 20:57 UTC
    Not a permissions issue else the perl script would have failed.
    use English; use Cwd qw(getcwd); use CGI qw/:standard/; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); #-- ppm install CGI::Session use CGI::Session; our $session; our $query = new CGI(); our $perl_sessions = "C:/webtmp"; if (!(defined($query->cookie("wweb")))) { $session = new CGI::Session("driver:File", undef, {Directory=> +$perl_sessions}); $cookie = $query->cookie(-name => "wweb", -value => $session->id); } exit(0);

      My bet still is on the permission issue. Reading the CGI::Session documentation for ->new, it points to the ->errstr class method as a way of finding why the constructor might fail. So, why aren't you checking errors? What does the following write to the error log and/or output?

      use strict; #use English; use Cwd qw(getcwd); use CGI qw/:standard/; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); #-- ppm install CGI::Session use CGI::Session; our $session; our $query = new CGI(); our $perl_sessions = "C:/webtmp"; if (!(defined($query->cookie("wweb")))) { $session = new CGI::Session("driver:File", undef, {Directory=> +$perl_sessions}) or die "Couldn't create CGI session: " . CGI::Session->err +str; $cookie = $q->cookie(-name => "wweb", -value => $session->id); } exit(0);

      Update Also looking at the CGI::Session documentation again, there is no CGI::Session::Driver::File but only CGI::Session::Driver::file, so maybe your error is in specifying "driver:File" instead of "driver:file".

      You're supposed to use CGI->... or CGI::Session->errstr()