CS 301-401: Web Programming

Running some simple Perl programs

Here is a Perl script that counts down from 10 to 1. Here, I have put the Perl script in the file "/users/server/students/www/cgi-bin/kalita/countdown.pl". I refer to this file as "Href="http://www.cs.uccs.edu/cgi-bin/kalita/countdown.pl" in my Web page. Note that "http://www.cs.uccs.edu/cgi-bin/kalita" is automatically translated to "/users/server/students/www/cgi-bin/kalita" by the www.cs.uccs.edu http server. Note that your Perl script must have read and execute permission for everyone. One way to make this happen is to use the Unix command "chmod uog+rx filename."

Here is another simple Perl script that just says hello. Here, I have built a soft link from the file "~kalita/public_html/cgi-bin/hello.pl" to a name "hello.pl" in the designated "cgi-bin" directory for the www.cs.uccs.edu server. This designated directory is "/users/server/students/www/cgi-bin/kalita". Note that your original Perl script must have read and execute permission for everyone. One way to make this happen is to use the Unix command "chmod uog+rx filename." The syntax for the linking is "%ln -s existing-file new-link" in Unix.

The last way to be able to invoke Perl scripts from the browser is to create a soft link from a new name in the designated "cgi-bin" directory for the server (i.e., a name in "/users/server/students/www/cgi-bin/") to a sub-directory in my home directory (i.e., "~kalita/") where I keep all my scripts. In my case, I plan to keep all my Perl scripts in the directory "~kalita/public_html/cgi-bin". So, I can create a new name called "jkkalita" in the directory "/users/server/students/www/cgi-bin" and link "~kalita/public_html/cgi-bin" to the name "/users/server/students/www/cgi-bin/jkkalita". I can now invoke any Perl script such as "hello.pl" in the "~kalita/public_html/cgi-bin/" directory by using Href="http://www.cs.uccs.edu/cgi-bin/jkkalita/hello.pl". The syntax used for linking is "ln -s ~kalita/public_html/cgi-bin jkkalita" in Unix if I am already in the directory /users/server/students/www/cgi-bin. Note that here "jkkalita" is a name that didn't exist before.

A Perl script that simply prints out the envrionment variables.

Some relevant links

HTML

Perl

JavaScript

The World Wide Web

The Internet

Others