This works fine when I test it on my site (which is hosted on a Linux box), but doesn't seems to work properly when testing it on my comp (running WinXP).

I'm trying to create a sessions with the following code:
my $var = 'test'; my $session = new CGI::Session("driver:File", undef, {Directory=>" +/tmp"}); $session->param("display_name", $display_name); $session->param("access_level", $access_level); $session->param("site_name", $site_name); $session->param("user_id", $user_id); $session->param("signature", $signature); $session->param('+18h'); my $cookie = $foo->cookie($var => $session->id); print $foo->header( -cookie=>$cookie );
As you can see, I want to use the contents of a variable as the name of the variable that will store the sessionID in the cookie.
And then retrieve the session's info with the following code:
my $sid = $foo->param('test'); my $session = new CGI::Session(undef, $sid, {Directory=>'/tmp'}); my $access_level = $session->param("access_level") || 0; my $display_name = $session->param("display_name") || ""; my $user_id = $session->param("user_id") || 0; print "Sid: $sid<BR> Session: $session<BR> Access: $access_level<BR> Name: $display_name<BR> User ID: $user_id<BR>\n";
With the print statement, I get:
Sid: bab864bfd5e46898b2252e19cffdf038 Session: CGI::Session::File=HASH(0x1bc0680) Access: 0 Name: User ID: 0
When I do the same test on my website (exact same script) it works fine. The appropriate access, name, and User ID are printed. I'm completely stumped to why this isn't working on my machine.

Thx for any help you might be able to offer,
Steny

In reply to CGI::Session - Problems creating session... by Steny

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.