|
USING ENVIRONMENT VARIABLES Getting and using rudimentary input. Unless your scripts are intened to only display something like the date and time, you will be wanting to get some input from your users in order to create dynamic pages or do some other sort of processing. As outlined in the Introduction, a proper WWW browser sends requests for data to an HTTP server. These requests also include information about the browser's computing environment. These things might include the Internet name and IP address of the browser's computer, what sort of data the browser can accept, the name of the browser, and the URL the browser is currently displaying. To Perl, this set of information is known as environment variables and can be quite useful in CGI scripting. |
EXAMPLE #1 |
The following example (
"Show me my environment" As the script demonstrates, quite a lot of useful information is available to CGI scripts through the environment variables. Based on this information alone a person could create simple authentication scripts, or dynamic HTML pages based on the client's operating system or the preferred image format. |
EXAMPLE #2 |
By appending a question mark (?) and some text to the script's URL, an HTML author can supply more input for the exact same script as demonstrated below. (Notice how the value of query string changes from Example #1 and Example #2.)
Rudimentary HTML input |
THE CODE |
|
HOW IT |
The operation of this script is not much different from the operations of the previous examples:
|
Version: 1.5
Last updated: 2004/12/23. See the release notes.
Author: Eric Lease Morgan (eric_morgan@infomotions.com)
URL: http://infomotions.com/musings/waves/