Re: Cookie Function Thingy
by btrott (Parson) on Mar 31, 2000 at 03:17 UTC
|
for my $key (keys %ENV) {
print $key, ": ", $ENV{$key}, "<br>\n";
}
This should print out all of the values in %ENV--
you're using the right variable, but perhaps this will
give a hint as to why it's not working.
Also, please post the code that you're using to
set the cookie.
And I'm not trying to point you towards CGI.pm, but what
doesn't work about it? | [reply] [d/l] |
Re: Cookie Function Thingy
by turnstep (Parson) on Mar 31, 2000 at 04:57 UTC
|
Your code looks okay. When I went to the page, it set three
cookies for me. Try turning on cookie notification if your browser
supports it. (Some show only the name and value, but some
(IE I believe is one)
show all the details) The best domain to set it to in your case is
"thegamepage.tripod.com" (no leading period)
The browser, when it loads your page, looks at all of it's cookies,
and then uses the domain to figure out whether or not to
send each one. If it is sent, the web server reads it into the
environment variables, which perl accesses through the hash %ENV.
Just some background...
| [reply] |
RE: Cookie Function Thingy
by Anonymous Monk on Mar 31, 2000 at 03:26 UTC
|
Thanks for that Code! Here is some info:
1. My address is: http://thegamespage.tripod.com
2. The script is at: http://thegamespage.tripod.com/cgi-bin/cookie/test2.pl
3. The cookie is visible in my netscape cookie file.
4. I have had the domain set to: tripod.com, .tripod.com, thegamespage.tripod.com, .thegamespage.tripod.com. and even nothing (so it sets it itself)
5. That code you gave me shows no cookies set.
6. The 2 scripts I use are both in the same directory.
Any other ideas? | [reply] |
|
|
| [reply] |
RE: Cookie Function Thingy
by Anonymous Monk on Mar 31, 2000 at 03:28 UTC
|
The script to add the cookie is located at: http://thegamespage.tripod.com/cgi-bin/cookie/test.pl | [reply] |
RE: Cookie Function Thingy
by Anonymous Monk on Mar 31, 2000 at 03:41 UTC
|
| [reply] |
RE: Cookie Function Thingy
by Anonymous Monk on Mar 31, 2000 at 03:47 UTC
|
Here it is:
$name="cookie_name";
$value="cookie_value";
#$cur_date = "Tue, 28 Mar 2000 06:10:23 -0500";
$expires_date = "Fri, 31 Mar 2000 13:49:23 -0500";
$path = "/";
$domain = ".tripod.com";
print "Content-type: text/html\n";
print "Set-Cookie: $name=$value; expires=$expires_date; path=$path; domain=$domain\n\n";
| [reply] |
RE: Cookie Function Thingy
by Anonymous Monk on Mar 31, 2000 at 03:10 UTC
|
AND PLEASE DON'T DIRECT ME TO CGI.PM! THAT DOESN'T WORK FOR ME AT ALL! | [reply] |
Re: Cookie Function Thingy
by stephen (Priest) on Mar 31, 2000 at 03:39 UTC
|
Anonymous...
I don't think we can proceed much further without seeing
your code, or at least the relevant sections. Seems to me that the question has more to do with
cookies than Perl, but we can't tell without some code, since the stuff you've told us seems OK. (Make sure you enclose it in <CODE></CODE>
tags.)
Also, to echo btrott above... what do you mean when you say that CGI.pm doesn't
work for you? Do you mean that it gives an error, that it's not on your site,
or just that you don't like it?
stephen
| [reply] |
|
|
Well, from that later email, it seems he/she is on tripod.
And tripod is pretty limited in the modules they provide,
I think. There's a list,
and it doesn't include CGI::Cookie. So perhaps that
explains it (it does include CGI.pm, but I think the poster
would need CGI::Cookie as well in order to use cookies,
so that rules that out).
| [reply] |
|
|
Hmmm.... no, CGI by itself handles cookies fine with its cookie()
method. You don't need CGI::Cookie in addition, I don't think...
correct me if I'm wrong, smoking something, or both.
| [reply] |
|
|
|
|