I just tested your program on Apache/Win2000. Worked fine for me, so you're on the right track.
Your test could use some detail; instead of redirecting, print a standard header with cookie along with a page with a self-referencing link. That way you aren't throwing it in a loop. Also, if you're using Mozilla, I suggest installing Livehttpheaders. It's great for debugging CGI scripts.
Good luck to you.
use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); # New CGI object my $q = CGI->new(); my $test = $q->cookie("test"); if (defined $test) { print $q->header; print $q->start_html('Test stuff'); print "<BR><BR>\n"; print "I got cookie value: $test<BR>\n"; print $q->end_html; } else { my $cookie = $q->cookie(-name => 'test', -value => 'test value'); print $q->header(-cookie => $cookie); print $q->start_html("Test page"); print $q->p(q[<a href="] . $q->self_url . q[">check cookie</a>]); print $q->end_html; }
John J Reiser
newrisedesigns.com
In reply to Re: (nrd) cookies/redirect problem
by newrisedesigns
in thread cookies/redirect problem
by ibanix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |