Referring to the
CGI documentation, the following example is presented.
$cookie = $query->cookie(-name=>'sessionID',
-value=>'xyzzy',
-expires=>'+1h',
-path=>'/cgi-bin/database',
-domain=>'.capricorn.org',
-secure=>1);
print $query->header(-cookie=>$cookie);
I would recommend that you read the pod for
CGIand use the code presented there. As a pointer, I would stick to the
CGI module and not use
CGI::Cookie. I say this as I've had no end of problems with
CGI::Cookie in the past that disappeared once
CGI was used instead.
Note that the code example assumes you have already created a CGI query object.
Hope that helps.