
NCGI::Response::Header - HTTP Header object for NCGI

use NCGI::Response::Header;
my $header = NCGI::Response::Header->new();
$header->content_type('text/plain');
$header->status('200 OK');
$header->test_header('tested');
$header->_add_multi('1');
$header->_add_multi('2');
$header->_send();
print "The header sent was:\n\n",$header->_as_string();
# The header sent was:
#
# Content-Type: text/plain
# Status: 200 OK
# Multi: 1
# Multi: 2
# Test-Header: tested

NCGI::Response::Header provides a simple HTTP Header object for responding to CGI requests.

Returns a new NCGI::Response::Header object.
Adds a 'Location:' header, making sure that there is no 'Status:' header as well.
Create/Set the header 'Header-Type'. Notice that underlines are converted to dashes and that the first character of words are uppercased. This is an AUTOLOAD function meaning you can create whatever headers you like. If there were previously multiple 'Header-Type' headers then they are all replaced by the value of this call.
There is no validity checking when setting so you should read the HTTP/MIME specifications for valid strings.
Add a header 'Header-Type'. This can be called multiple times and multiple headers will be sent. Notice the automatic formatting as is done for header_type.
Returns a string representation of the HTTP Header.
Print the HTTP header to STDOUT. Exactly the same as 'print $header->_as_string;' except that _send keeps track if it has already been called and will croak if called more than once.


Mark Lawrence <nomad@null.net>

Copyright (C) 2005-2008 Mark Lawrence <nomad@null.net>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.