Can someone show me an example on how to use cookies?
I've been trying to find an easy example online, but I don't understand them.
Here is what I got out of it, but it doesn't work:
I'm assuming that the -name is the name field in the form and the -value is the value field but who knows.
I've been trying to find an easy example online, but I don't understand them.
Here is what I got out of it, but it doesn't work:
Code:
use CGI qw/:standard/;
use CGI::Cookie;
$cookie = new CGI::Cookie(-name => 'filename', -value => 'grades');
$cookie2 = new CGI::Cookie(-name => 'direction', -value => 'Reverse');
print header(-cookie => [$cookie, $cookie2]);
%cookies = fetch CGI::Cookie;
$filename = $cookies{'filename'} -> value;
$direction = $cookies{'direction'} -> value;
print "Set-Cookie: $cookie\n";
Comment