
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Perl CGI Environment Variables
All the Perl CGI program will have access to the following environment variables. These variables play an important role while writing any CGI program in Perl.
Sr.No | Variables Names & Description |
---|---|
1 |
CONTENT_TYPE The data type of the content. Used when the client is sending attached content to the server. For example file upload, etc. |
2 |
CONTENT_LENGTH The length of the query information. It's available only for POST requests |
3 |
HTTP_COOKIE Returns the set cookies in the form of key & value pair. |
4 |
HTTP_USER_AGENT The User-Agent request-header field contains information about the user agent originating the request. Its name of the web browser. |
5 |
PATH_INFO The path for the CGI script. |
6 |
QUERY_STRING The URL-encoded information that is sent with GET method request. |
7 |
REMOTE_ADDR The IP address of the remote host making the request. This can be useful for logging or for authentication purpose. |
8 |
REMOTE_HOST The fully qualified name of the host making the request. If this information is not available then REMOTE_ADDR can be used to get IR address. |
9 |
REQUEST_METHOD The method used to make the request. The most common methods are GET and POST. |
10 |
SCRIPT_FILENAME The full path to the CGI script. |
11 |
SCRIPT_NAME The name of the CGI script. |
12 |
SERVER_NAME The server's hostname or IP Address. |
13 |
SERVER_SOFTWARE The name and version of the software the server is running. |
Here is a small Perl CGI program to list down all the CGI variables supported by your Web server. Click this link to see the result Get Environment
#!/usr/bin/perl print "Content-type: text/html\n\n"; print "<font size=+1>Environment</font>\n"; foreach (sort keys %ENV) { print "<b>$_</b>: $ENV{$_}<br>\n"; } 1;
Advertisements