For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > May 2005 > CGI::Session









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author CGI::Session
Alexandre Jaquet

2005-05-29, 3:56 pm

Hi,

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


#!perl -w
use strict;

use CGI;
use CGI::Session;

my $CGISESSID;
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/Session.pm line 150
[Sun May 29 18:57:45 2005] [error] [client 62.167.177.217]
CGI::Session::_validate_driver('CGI::Ses
sion=HASH(0x167339c)') called at
C:/indigoperl/perl/site/lib/CGI/Session.pm line 55
[Sun May 29 18:57:45 2005] [error] [client 62.167.177.217]
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 62.167.177.217] (in cleanup)
Can't locate auto/CGI/Session/store.al in @INC (@INC contains:
C:/indigoperl/perl/lib C:/indigoperl/perl/site/lib .) at
C:/indigoperl/perl/site/lib/CGI/Session.pm line 429

thanks in advance
Alexandre Jaquet

2005-05-29, 3:56 pm

Alexandre Jaquet a écrit :
> Hi,
>
> Does anybody know what's the problem with my code :
>
>
> #!perl -w
> use strict;
>
> use CGI;
> use CGI::Session;
>
> my $CGISESSID;
> 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/Session.pm line 150
> [Sun May 29 18:57:45 2005] [error] [client 62.167.177.217]
> CGI::Session::_validate_driver('CGI::Ses
sion=HASH(0x167339c)') called at
> C:/indigoperl/perl/site/lib/CGI/Session.pm line 55
> [Sun May 29 18:57:45 2005] [error] [client 62.167.177.217]
> 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 62.167.177.217] (in
> cleanup) Can't locate auto/CGI/Session/store.al in @INC (@INC contains:
> C:/indigoperl/perl/lib C:/indigoperl/perl/site/lib .) at
> C:/indigoperl/perl/site/lib/CGI/Session.pm line 429
>
> thanks in advance


finally solved by modify the session creation :

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

2005-05-29, 3:56 pm

Alexandre Jaquet wrote:

> Hi,
>
> Does anybody know what's the problem with my code :
>
>
> #!perl -w
> use strict;
>
> use CGI;
> use CGI::Session;
>
> my $CGISESSID;
> 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/Session.pm line 150 [Sun May 29
> 18:57:45 2005] [error] [client 62.167.177.217]
> CGI::Session::_validate_driver('CGI::Ses
sion=HASH(0x167339c)') called
> at C:/indigoperl/perl/site/lib/CGI/Session.pm line 55 [Sun May 29
> 18:57:45 2005] [error] [client 62.167.177.217]
> 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 62.167.177.217] (in cleanup) Can't
> locate auto/CGI/Session/store.al in @INC (@INC contains:
> C:/indigoperl/perl/lib C:/indigoperl/perl/site/lib .) at
> C:/indigoperl/perl/site/lib/CGI/Session.pm line 429
>
> thanks in advance


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

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

You are passing no arguments to new.

Mark
Fabian Pilkowski

2005-05-29, 8:56 pm

* Alexandre Jaquet schrieb:
[color=darkred]

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).
[color=darkred]
>
> finally solved by modify the session creation :
>
> $session = new CGI::Session ("driver:File", undef, {Directory =>
> 'C:/tmp' });


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

regards,
fabian
Tad McClellan

2005-05-29, 8:56 pm

Alexandre Jaquet <alexj@freesurf.ch> wrote:
> Alexandre Jaquet a écrit :


[color=darkred]

[color=darkred]
> finally solved



How did you discover the solution?

That is, where did you find that solution?


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



--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com