NAME

Message::CGI::HTTP - An Object-Oriented HTTP CGI Interface


DESCRIPTION

The Message::CGI::HTTP module provides an object-oriented interface for inputs and outputs as defined by CGI specification.

This module is part of manakai.


METHODS

$cgi = Message::CGI::HTTP->new;
Creates and returns a new instance of HTTP CGI interface object.

$value = $cgi->get_meta_variable ($name)
Returns the value of the meta-variable $name. The name specified by the $name SHOULD be a meta-variable name defined by a CGI specification, e.g. CONTENT_TYPE or HTTP_USER_AGENT. Otherwise, the result is implementation dependent. In an environment where meta-variables are supplied as envirnoment variables, specifying an environment variable that is not a meta-variable, such as PATH, results in the value of that environment variable. However, CGI scripts SHOULD NOT depend on such behavior.

This method might return undef when the meta-variable is not defined or is defined but its value is undef.

$list = $cgi->meta_variable_names;
Returns list of meta variables. Note that this list might contain other environmental variables than CGI meta variables, since they cannot distinglish unless we know what is CGI meta variable and what is not. Unfortunately, there is no complete list of CGI meta variables, whilst list of standarized meta variables is available.

NOTE: Some application might use an environmental variable named 'HTTP_HOME', which might make some confusion with CGI meta variable for HTTP 'Home:' header field. Fortunately, such name of HTTP header field is not intoroduced as far as I know.

This method returns a Message::DOM::DOMStringList.

$value = $cgi->get_parameter ($name);
Returns parameter value if any. Parameter value is set by query-string of Request-URI and/or entity-body value.

When multiple values with same parameter name is specified, the first one is returned in scalar context or an array reference of all values is returned in array context. (Note that query-string is ``earlier'' than entity-body.)

$keys = $cgi->parameter_names;
Returnes a list of parameter names provided.

This method returns a Message::DOM::DOMStringList.

$body = $cgi->entity_body;
Returns entity-body content if any.

$uri = $cgi->request_uri;
Returns Request-URI as a Message::URI::URIReference object.

Note that stringified value of returned value might not be same as the URI specified as the Request-URI of HTTP request or (possibly pseudo-) URI entered by the user, since no standarized way to get it is defined by HTTP and CGI/1.1 specifications.

$value = $cgi->path_info ([$new_value]);
This method reflects the meta-variable with the same name (in uppercase).


TODO

multipart/form-data support


SEE ALSO

A draft specification for DOM CGI Module <http://suika.fam.cx/gate/2005/sw/manakai/%E3%83%A1%E3%83%A2/2005-07-04> (This module does not implement the interface defined in this specification, however.)


AUTHOR

Wakaba <w@suika.fam.cx>

This module was originally developed as part of SuikaWiki.


LICENSE

Copyright 2003, 2007 Wakaba <w@suika.fam.cx>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.