Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: CGI Session

by Abigail-II (Bishop)
on Jun 23, 2004 at 16:48 UTC ( #369111=note: print w/replies, xml ) Need Help??


in reply to CGI Session

Just as the error message says, you don't have the module DB_File installed, or not properly installed. It seems to be a requirement for the CGI::Session module that you are using.

Abigail

Replies are listed 'Best First'.
Re^2: CGI Session
by shaolindoman (Acolyte) on Jun 23, 2004 at 17:24 UTC
    I;m sorry I thought that I had installed that. I must have installed the wrong thing. Thanks for your help.
Re^2: CGI Session
by shaolindoman (Acolyte) on Jun 23, 2004 at 17:34 UTC
    Ok, now I'm getting this error: <code> (in cleanup) could not flush: Couldn't store ab4a75f8bddea52a28b08e0880a 41d41 into \tmp\cgisess_ab4a75f8bddea52a28b08e0880a41d41: No such file or direct ory at login.cgi line 0 <code> which seems to undicate I havn't created the direcotry. But I have the direcotry /tmp created so I'm curious what the problem is here. This directory: cgisess_ab4a75f8bddea52a28b08e0880a41d41 is supposed to be created inside of /tmp, correct? (to keep track of the session of that particular user)
      /tmp is an unlikely directory to have on Windows. Make sure there is a \tmp on the same drive as the web site (c:\tmp or d:\tmp) and that it is writable by the web server.
Re^2: CGI Session
by shaolindoman (Acolyte) on Jun 23, 2004 at 18:26 UTC
    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.

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


      ___________
      Eric Hodges

      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"});    
      

      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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://369111]
help
Chatterbox?
[Your Mother]: Stick with what you know. Or post a SOPW and if it's not complicated I guarantee someone will answer; me if it's straightforward and no one else gets it better first.
[1nickt]: ++YourMother (Grammar Vigilante of Bristol)
[Lady_Aleena]: Um, how does grep do multiline? print "$file:$_" if grep { /get_(array|hash| data)\(.+\)/ } $_; only returns the same 18 lines the command line grep does.
[Lady_Aleena]: my scratchpad has what I have so far.
[choroba]: what do you mean by multiline?
[Discipulus]: thanks 1nickt!
[choroba]: grep is a filter, it selects elements from a list based on a boolean condition
[moritz]: you need to read the file in one go to do a multiline regex match
[erix]: ha ha, I like the Vigilante
[Lady_Aleena]: Forget it. I'm getting angry with it.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2017-05-23 19:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?