Name
set_cookie
Synopsis
$cjar->set_cookie(version,key,val,path,domain,port,path_spec,secure,maxages,discard, \%misc)
Sets a cookie in the cookie jar with the information given in the arguments. The number and order of arguments represent the structure of elements in the Set-Cookie3 header lines used to save the cookies in a file.
versionA string containing the cookie-spec version number.
keyThe name of the cookie.
valThe value of the cookie.
pathThe pathname of the URL for which the cookie is set.
domainThe domain name for which the cookie is set.
portThe port number of the URL for which the cookie is set.
path_specA Boolean value indicating if the cookie is valid for the specific URL path or all the URLs in the domain. The path is used if true; otherwise, the cookie is valid for the entire domain.
secureA Boolean value indicating that the cookie should only be sent over a secure connection for true, or over any connection for false.
maxageThe number of seconds that the cookie will be valid from the time it was received. Adding the
maxageto the current time will yield a value that can be used for an expiration date.discardA Boolean value indicating that the cookie should not be sent in any future requests and should be discarded upon saving the cookie jar, unless the
ignore_discardparameter was set to true in the constructor.%miscThe final argument is a reference to a hash,
%misc, that contains any additional parameters from the Set-Cookie headers such as Comment and URLComment, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access