Name
header
Synopsis
$
query
->header([content_type
,status
,headers
])
Generates the HTTP header for the document.
content_type
The content type to return. Default is
text/html
.status
The HTTP status code and description to return. Default is
200 OK
.headers
Additional headers to include, such as
Content-Length: 123
. Using named parameters, the syntax is:print $query->header(-type=>'
content_type
', -nph=>1, -status=>'status_code
', -expires=>'expcode
', -cookie=>'cookie
', -target=>'frame
', -header=>'value
');-type=>
content_type
Specifies the content type.
-nph=>1
Uses headers for a no-parse-header script.
-status=>
status_code
Specifies the status code.
-expires=>
expcode
Specifies an expiration timestamp (such as
+3d
for three days). Values forexpcode
are:n
s
n
secondsn
m
n
minutesn
h
n
hoursn
d
n
daysn
M
n
monthsn
y
n
yearsday_of_week
,dd
-MMM
-YY hh:mm:ss
GMT
At the specified time
now
Expires immediately
-cookie=>
cookie
Specifies a cookie. The cookie may be a scalar value or an array reference.
-header=>
value
Specifies any HTTP header.
-target=>
frame
Writes to specified frame.
Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.