JavaDeploy
SiteMap
Perl 1
Perl 2
ASP
XML
Web Perl
«Prev
Next»
Web Perl
Web Server Basics
Http Protocol
Perl Basics
Perl Web Language
Perl Brief History
Compiled vs. Interpreted
Perl Language
Cross Platform Availability
Awk Sed Perl Text
Perl Regex
Pattern Matching
Powerful Pattern Matching
Regexp Substitute Operator
Execute Replacement Component
Aggregate Data Types
Perl Array
Perl Hash
Array hash Association
Perl References
Scalar References
Array References
Hash References
Perl Data Structure
Perl Web Programming
CGI Forms
About Web Forms
Passing Data Server
Server CGI Program
Get post Methods
Form Data encoding
Perl Widgets
Perl Form Conclusion
Perl CGI
Perl Program Flow
State Machine Model
Perl SM Example
Perl based HTML
CGI State Machine Model
Processing States using CGI
Perl Guestboook
Identify Perl Cookie Functionality
Set Read Cookies
Expire Perl Cookie
Clearing Perl Cookie State
Perl Interfaces Conclusion
Pipes Streams
Perl Stream
Write File Stream
Reading File Streams
Perl Pipe
Send email
email Form
Streams | Pipes
How to run CGI Program - Exercise
Below are the questions you need to answer before you can run a CGI program. Make note of what you find out and send it to us by pasting your notes in the text area at the end of this page. That will serve as the results of this exercise for you, and it will also help us to assist you should you have any problems running your CGI programs later on in the course.
Are you allowed to run CGI programs on your server?
If not, you will need to either obtain permission, or set up and run a server on your own computer. An excellent solution to this problem is to get a simple inexpensive PC (even an old discarded 486 or 386 will suffice), and load
Linux
and the
Apache
Web server on it.
This configuration will be plenty fast for your local testing purposes (in fact, with a Pentium it will be as fast or faster than most servers on the Internet today), and if you are not already familiar with Unix, it will be a valuable experience to install it and set it up.
What is the location of the Perl interpreter on your system?
If you are using Unix, will need to make sure that the
"#!/usr/bin/perl"
line in the program agrees with this location, or it will not work.
If your system is not Unix-based, you will also need to find out what procedures are necessary to run Perl with CGI on your system. You will probably need to remove the "#!/usr/bin/perl" line from the top of the Perl script, and run a special container for the Perl interpreter.
What directory do you need to put your CGI program in? This will be different for every server.
What filename restrictions are there for CGI programs?
Some servers that allow CGI programs in the document tree, require that their filenames end in ".cgi". You will need to find out about this.
What permissions or attributes need to be set for your CGI program to execute?
In Unix, it is usually sufficient to use:
chmod 755 filename
What is the URL to access your CGI program?
This will depend on the answer to 3 and 4. If you must put your CGI program in a special "cgi-bin" directory, the URL will probably be something like "http://www.yourserver.com/cgi-bin/hello.cgi"
Perl CGI Scripting
Installing Linux and Apache can be an adventure in itself, especially if you are not familiar with Unix. Our tutors will do their best to answer questions, if they are able, but please remember that this course is about Perl and CGI, not installing new operating systems. There are many places you can go for help, and we will direct you to them as best we can. DistributedNetworks is not responsible for any problems that may arise as a result installing a new operating system on your computer. Answering these questions before you try to run your first CGI program will alleviate 90% of the problems most first-time CGI programmers experience. Paste your notes about setting up your server in the text area below and click
Submit
when you are finished.
Submit