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.
-domain
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.
-expires
(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
now immediately
+6M 6 months from now
+1y 1 year from now
Monday, 28-Dec-98 12:30:00 GMT expire at this specific date & time
-name
the name of the cookie (req’d)
-path
(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 ‘/’.
-secure
(optional) The cookie will only be sent if the CGI request is occurring on a secure channel.
-value
(req’d) The value of your cookie. This can be a scalar value, array reference, or hash reference.
FOR EXAMPLE
#!/bin/perl use CGI; $query = new CGI; $cookie = $query->cookie(-name=>'MY_COOKIE_TEST', -value=>'MY_VALUE', -expires=>'+2h', -path=>'/');