http://qs321.pair.com?node_id=657274


in reply to Another question about session-id

Could this not be modified to suit:

#!/usr/bin/perl -w use strict; if ($ENV{'QUERY_STRING'} ne 'TESTING') { print "HTTP/1.0 302 Moved Temporarily\n"; print "Set-Cookie: Cookie=Test\n"; print "Location: $ENV{'SCRIPT_NAME'}?TESTING\n\n"; } else { if ($ENV{'HTTP_COOKIE'} =~ /Cookie=Test/) { print("Content-type: text/html\n\n"); print("<HTML>"); print("<HEAD><TITLE>$ENV{'HTTP_USER_AGENT'} supports Cookies</ +TITLE></HEAD>"); print("<BODY>"); print("Your browser, $ENV{'HTTP_USER_AGENT'}, supports the Net +scape HTTP "); print("Cookie Specification."); print("</BODY></HTML>"); } else { print("Content-type: text/html\n\n"); print("<HTML>"); print("<HEAD><TITLE>$ENV{'HTTP_USER_AGENT'} doesn't support Co +okies</TITLE></HEAD>"); print("<BODY>"); print("Your browser, $ENV{'HTTP_USER_AGENT'}, doesn't appear t +o support cookies."); print("Cookie Specification."); print("</BODY></HTML>"); } }

From What is CGI.