next up previous contents
Next: Debugging CGI scripts Up: Perl on the Web Previous: Combo Forms   Contents

User Information methods

Web browsers generally transmit a fair amount of information to the web servers they contact. The CGI module provides a number of methods to extract this information. The self_url method returns a string containing the complete URL of the script being called; as seen in the previous section, this is very useful for combo forms. The user_agent method returns a string identifying the type of browser which called your CGI script. If you pass user_agent an argument, it will use it as a regular expression, and return the value of a pattern match of the argument with the value of the user agent string. The remote_host method returns the hostname or IP address of the host under which the browser is running. The referer method returns the URL of the page the browser was viewing prior to invoking the CGI script. Other similar methods are available; see the CGI module documentation.



Phil Spector 2002-10-18