Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


Does anybody know what's the problem with my code :

#!perl -w
use strict;

use CGI;
use CGI::Session;

my $session;
my $query = new CGI ;

$session = new CGI::Session();    
$CGISESSID = $session->id();

print "Content-type: text/html\n\n";
print "session : $CGISESSID";

error message :

CGI::Session doesn't seem to be a valid CGI::Session driver. At least
one method ('store') is missing at
C:/indigoperl/perl/site/lib/CGI/ line 150
[Sun May 29 18:57:45 2005] [error] [client]
CGI::Session::_validate_driver('CGI::Session=HASH(0x167339c)') called at
C:/indigoperl/perl/site/lib/CGI/ line 55
[Sun May 29 18:57:45 2005] [error] [client]
CGI::Session::new('CGI::Session') called at
C:/indigoperl/apache/cgi-bin/test-session.cgi line 11
[Sun May 29 18:57:45 2005] [error] [client]     (in cleanup)
Can't locate auto/CGI/Session/ in @INC (@INC contains:
C:/indigoperl/perl/lib C:/indigoperl/perl/site/lib .) at
C:/indigoperl/perl/site/lib/CGI/ line 429

thanks in advance

Re: CGI::Session

Alexandre Jaquet wrote:

Quoted text here. Click to load it

You aren't instantiating CGI::Session properly. From the documentation:

my $session = new CGI::Session(
        "driver:File", undef, );

You are passing no arguments to new.


Re: CGI::Session

Alexandre Jaquet a écrit :
Quoted text here. Click to load it

finally solved by modify the session creation :

$session = new CGI::Session ("driver:File", undef, {Directory =>
'C:/tmp' });

Re: CGI::Session

Quoted text here. Click to load it

How did you discover the solution?

That is, where did you find that solution?

Quoted text here. Click to load it

    Tad McClellan                          SGML consulting                   Perl programming
    Fort Worth, Texas

Re: CGI::Session

* Alexandre Jaquet schrieb:
Quoted text here. Click to load it

Could you explain why each of your my-statements needs an extra line of
code? It is not necessary, unless your salary primarily depends on the
number of lines you programmed for your boss. Consider to use

    my $session = new CGI::Session();
    my $CGISESSID = $session->id();
IMHO it's more readable if you declare your vars where you need them
(and not some lines above).

Quoted text here. Click to load it

Well, it is not wrong to read the documentation ;-)


Site Timeline