Last updated on November 18th, 2015 at 03:37 am
Below is the valid parameters that can be used when a cookie is being called using perl script, Below you will find how to use perl cookie with example.
a partial or complete domain name for which the cookie is valid. Like ‘mistonline.in’ for the entire domain (www.mistonline.in,php.mistonline.in, etc.), or ‘www.mistonline.in/wp’ to refer to one server.
(optional) The expiration date for this cookie.
+60s 60 seconds from now
+20m 20 minutes from now
+5h 5 hours from now
+1d 1 day from now
-3d 3 days ago
+6M 6 months from now
+1y 1 year from now
Monday, 28-Dec-98 12:30:00 GMT expire at this specific date & time
the name of the cookie (req’d)
(optional) If you specify this attribute, the browser will check it against your script’s URL before returning the cookie.
The default is set to ‘/’.
(optional) The cookie will only be sent if the CGI request is occurring on a secure channel.
(req’d) The value of your cookie. This can be a scalar value, array reference, or hash reference.
#!/bin/perl use CGI; $query = new CGI; $cookie = $query->cookie(-name=>'MY_COOKIE_TEST', -value=>'MY_VALUE', -expires=>'+2h', -path=>'/');