Hi
I started to learn CGI::Session and have made some progress thus far.
The below code successfully adds the session data inside a MySQL DB using CGI::Session, however it does not create a cookie. I have no idea where I can start to troubleshoot this problem. It has to do w/ a config setting I'm thinking, because the code seems to work for most other people.
#created the INPUT = New CGI; on previous lines
use CGI::Session;
my $session = new CGI::Session("driver:MySQL", undef, {
Handle => $dbh,
DataSource => "DBI:mysql:contrarian:host=my_server",
User => "srjiii",
Password => $df_pass });
$session->param("member_name", $username);
my $cookie = $INPUT->cookie(-name=>'SESSION_Name',
-value=>$session->id,
-expires=>"+1d");
print $INPUT->header(-cookie=>$cookie);
I read some threads in this website, and it says you must specify a domain name for your cookie? But how come the documentation for the CGI::Session and other examples I have looked at do not say anything about that? I made sure my browser accepts cookies and have looked inside the cookie folder for any cookie named "SESSION_Name" and no luck. What Am I doing wrong? Is it something to do with the code I have or just a config. that I'm not understanding?
IF anyone can tell me some articles/threads that show how you can troubleshoot why your script is not creating a cookie that will be great!
thanks Monks!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.