Perl environment values are very similar to SSI environment values. Two of the most common environment values used are :
Here is an example to show how to use these two environments :
See it in action!
You may encounter a blank value for the REFERER value. This environment value will only hold a value IF the visitor clicked on a link to get to that page. If the visitor types in the URL manually, the value will be blank. There may be other occurances of a blank value, but this is the most common.
The other environments available are :
|
$ENV{'HTTP_USER_AGENT'} $ENV{'HTTP_REFERER'} |
Browser type/version Referral page info |
Here is an example to show how to use these two environments :
|
#!/usr/bin/perl print "Content-type: text/html\n\n; $browser = $ENV{'HTTP_USER_AGENT'}; $from = $ENV{'HTTP_REFERER'}; print "You are browsing this page with $browser <br>"; print "And before this webpage, you were visiting this webpage : $from"; |
You may encounter a blank value for the REFERER value. This environment value will only hold a value IF the visitor clicked on a link to get to that page. If the visitor types in the URL manually, the value will be blank. There may be other occurances of a blank value, but this is the most common.
The other environments available are :
| $ENV{' '} | Results |
|---|---|
|
DOCUMENT_ROOT HTTP_COOKIE HTTP_HOST HTTPS PATH QUERY_STRING REMOTE_ADDR REMOTE_HOST REMOTE_PORT REMOTE_USER REQUEST_METHOD REQUEST_URI SCRIPT_FILENAME SCRIPT_NAME SERVER_ADMIN SERVER_NAME SERVER_PORT SERVER_SOFTWARE |
Root directory of your server. Visitor's cookie (if set). Hostname of your server. ON if called through a secure server. Systems path your server runs under. The query data (used with GET). IP address of visitor. Hostname of visitor. Port the visitor is connected to on web server. Visitor's username. GET or POST Interpreted pathname of requested document. Full pathname of current CGI page. Interpreted pathname of current CGI (relative to root). Email address for your server's webmaster. Your server's domain name. Port number your server is listening on. Server software being used (ex. Apache 1.3) |

