FETCHING ENVIRONMENT VARIABLES

Some of the more useful environment variables can be fetched through this interface. The methods are as follows:

accept()
Return a list of MIME types that the remote browser accepts. If you give this method a single argument corresponding to a MIME type, as in $query->accept('text/html'), it will return a floating point value corresponding to the browser's preference for this type from 0.0 (don't want) to 1.0. Glob types (e.g. text/*) in the browser's accept list are handled correctly.

raw_cookie()
Returns the HTTP_COOKIE variable, an HTTP extension implemented by Netscape browsers version 1.1 and higher. Cookies have a special format, and this method call just returns the raw form (?cookie dough). See cookie for ways of setting and retrieving cooked cookies.

user_agent()
Returns the HTTP_USER_AGENT variable. If you give this method a single argument, it will attempt to pattern match on it, allowing you to do something like $query->user_agent(netscape);

path_info()
Returns additional path information from the script URL. E.G. fetching /cgi-bin/your_script/additional/stuff will result in $query->path_info() returning ``additional/stuff''.

NOTE: The Microsoft Internet Information Server is broken with respect to additional path information. If you use the Perl DLL library, the IIS server will attempt to execute the additional path information as a Perl script. If you use the ordinary file associations mapping, the path information will be present in the environment, but incorrect. The best thing to do is to avoid using additional path information in CGI scripts destined for use with IIS.

path_translated()
As per path_info but returns the additional path information translated into a physical path, e.g. ``/usr/local/etc/httpd/htdocs/additional/stuff''.

The Microsoft IIS is broken with respect to the translated path as well.

remote_host()
Returns either the remote host name or IP address. if the former is unavailable.

script_name() Return the script name as a partial URL, for self-refering scripts.
referer()
Return the URL of the page the browser was viewing prior to fetching your script. Not available for all browsers.

auth_type ()
Return the authorization/verification method in use for this script, if any.

server_name ()
Returns the name of the server, usually the machine's host name.

virtual_host ()
When using virtual hosts, returns the name of the host that the browser attempted to contact

server_software ()
Returns the server software and version number.

remote_user ()
Return the authorization/verification name used for user verification, if this script is protected.

user_name ()
Attempt to obtain the remote user's name, using a variety of different techniques. This only works with older browsers such as Mosaic. Netscape does not reliably report the user name!

request_method()
Returns the method used to access your script, usually one of 'POST', 'GET' or 'HEAD'.