sdyates has asked for the wisdom of the Perl Monks concerning the following question:
I have spent two days on this and cannot figure what is the problem with CGI!
I grab a username and password from one perl script and passit to another...It is in this next script that I generate a cookie. However, the cookie is not registered by the browser unless I issue the following lines:
print "Set-Cookie: $cookie1\n"; print "Content-Type: text/html\n\n";
However, I do not want to print the cookie to the screen! Please help, I have included the methods I have created and if you could let me know where Iam wrong please.
Thanks, Siumonsub SetCookie { use CGI qw/:standard/; use CGI::Cookie; $cookie1 = new CGI::Cookie(-name=>'DB', -value=>{ username => $DBuser, password => $DBpasswd, }, -expires => '+1H'); print "Set-Cookie: $cookie1\n"; print "Content-Type: text/html\n\n"; } sub ReadCookie { %cookies = fetch CGI::Cookie; @id = $cookies{'DB'}->value; $exp = $cgi->header( -cookie => DB); print "$id[0] = $id[1]; $id[2] = $id[3]; Expiration = $exp"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI::Cookie issues
by jarich (Curate) on Nov 21, 2002 at 05:33 UTC | |
|
Re: CGI::Cookie issues
by grep (Monsignor) on Nov 21, 2002 at 03:25 UTC | |
by sdyates (Scribe) on Nov 21, 2002 at 03:36 UTC |