Perl CGI setting headers

 #!/usr/bin/perl -wT

use strict;
use warnings;

use CGI qw(:standard);

print header('text/plain', '404 Not Found');

print "Move along, nothing to see here\n";

At promp, execute: curl -i url-to-script

which returns:

HTTP/1.1 404 Not Found
Date: Fri, 04 Oct 2013 14:14:58 GMT
Server: Apache
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/plain; charset=ISO-8859-1

Move along, nothing to see here

#perl - #programming

From JR's : articles
59 words - 454 chars
created on - #
source - versions

Related articles
Probably my favorite Web apps to use and create - Jan 15, 2014
Test Automation using Perl - May 17, 2013
Perl Timer Code - Feb 11, 2015
Testing module to keep in mind - November 2002 - Jul 18, 2014
Perl regex extracting domain name from URL - Oct 02, 2013
more >>



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: Dec 12, 2024 - 8:08 p.m. EST