Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^2: CGI Session

by shaolindoman (Acolyte)
on Jun 23, 2004 at 18:26 UTC ( #369133=note: print w/replies, xml ) Need Help??

in reply to Re: CGI Session
in thread CGI Session

Well, here is my complete code that is generating this error:
use Data::Dumper; use CGI::Session; use CGI; my $cgi = new CGI; my $session = new CGI::Session(undef, $cgi, {Directory=>"\tmp" +}); $cookie = $cgi->cookie(CGISESSID => $session->id ); print $cgi->header(-cookie=>$cookie);
With New error:
(in cleanup) could not flush: Couldn't store 4206b0c8bba60b524 +6ced512c58 f5481 into mp\cgisess_4206b0c8bba60b5246ced512c58f5481: Invalid a +rgument at login.cgi line 0
It seems like it won't create a session basically which I'm not sure why. I've searched the net and everywhere else and havn't found anyone with a similar problem (except one German site I couldn't read hehe). Any ideas? I'm going nuts trying to figure this out.

Replies are listed 'Best First'.
Re^3: CGI Session
by eric256 (Parson) on Jun 23, 2004 at 20:05 UTC

    \t inside doulbe quotes becomes a tab. Use "/tmp" instead. Where in your file system did you create the tmp folder?

    Eric Hodges
Re^3: CGI Session
by Anonymous Monk on Jun 23, 2004 at 19:56 UTC

    As was mentioned above, you have to give it a valid directory path. \tmp is probably not a valid directory path. For example, if you want your session files stored in a directory called SESSION located in the root of your C drive, make the directory there and use:

    my $session = new CGI::Session(undef, $cgi, {Directory=>"C:\\SESSION"});    
Re^3: CGI Session
by Wally Hartshorn (Hermit) on Jun 23, 2004 at 20:58 UTC

    Eric put his finger on it - \t within double-quotes is a tab. (If you look closely at the error message, you'll see blank space -- the tab -- where the "\t" should be.) Change your code to this:

    my $session = new CGI::Session(undef, $cgi, {Directory=>'\tmp'});

    and try again.

    Wally Hartshorn

      Thanks guys for your help. It is working fine now.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://369133]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2021-09-25 00:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found