Prelim 1

We assume that you are working at a PC or Mac, connected to a server which is going to provide the "home page" which is presented to the outside world. Of course, your own (local) PC or Mac may be the server, and indeed, you may be programmer, system manager, and general factotum, but you would be better served to have someone else maintain (and periodically backup) the WWW server. Such an expert can provide you with enhanced security against intrusion by hostile hackers (and students), can upgrade the service utilities which you will employ, can offer help with arrangement of files, etc., and generally can take care of you (and others) without burdening you with this extra responsibility, so think about it, and see if a central server with a manager isn't somewhere in your future.

For the purposes of this discussion, the server will be a UNIX server. Of course you can use other operating systems, but this is the most common one, and most likely, this will be the one you find if you use a high powered server rather than your own personal computer.

We further assume that on your desktop PC or Mac, or whatever, you can run a multi-windowed set of programs, one of which should be a net browser such as Mosaic or Netscape, and another of which should be telnet (to communicate directly with the server). We assume that you are directly connected to the internet, so that each of these can be active. You might want a calculator window open also, but this is clearly optional. With these two windows, you can connect doubly to your server. First, in the telnet window, you telnet to your server and login. Second, in the browser window, you open the browser to the same server. Before you do this, you should have the server's system administrator establish an account on the server which is properly protected (from hackers) and whose address can be published. My personal address is: http://chemphys.uconn.edu/~cdavid/home.html in which everything but the `home.html' part is mandatory to get to both my computer (chemphys.uconn.edu) and my account (~cdavid). Once the system administrator has done his/her job, you need to decide on what `face' you want to present to the outside world.

Depending on the server running on your system, a user may or may not be able to open your site with a simple

http://chemphys.uconn.edu/~cdavid/
which, at least on the server this manuscript is home to, gives (i.e., serves up to the requester) `index.html', `Welcome.html',`Welcome.shtml' if any of them exist, but on other servers gives a directory listing of the relevant directory. As usual, hacker wisdom calls for you to try it and see what happens!
Usually, one has a home page or a `Welcome' page. The so-called home page, is the first place that every user should come to when `opening' his/her viewer to your location.
This means that you must create an HTML page, usually called `index.html', which will have links to all you other items (questions, etc.). We are going to create the simplest of home pages here, which you should type into a file:
<HEAD>
<H1>How to Write Computer Assisted Testing Question</H1>
</HEAD>
<BODY>
<br>
 
<H2>Using CGI.pm to write Perl `Programs'</H2>
<!- start of list of Chapters and/or Subjects ->
 
<H3>Tentative Table of Contents</H3>
<UL>
<LI><A HREF="question1.pl">Question 1</A>
</UL>
</BODY>
If you save the above text in a file known as `index.html' in the public_html directory of the server under your account (my account here `cdavid'), then when a user uses the URL:
http://chemphys.uconn.edu/~cdavid/
the user will see the code you have typed in appear in the user's browser's window.
The server's account (`cdavid' in my case) was set up with a `public_html' sub-directory. If it wasn't created, you have to do it, i.e., create such a sub-directory (vide infra).
One small warning. If you click on the `Test the above html code' box below, you will find that the question, Question 1, is not operative, and when you click on it you will get an error. A perl program can not reside in the public_html subdirectory, as it is executable, and must reside in the cgi-bin (or lower on some servers) subdirectory (vide infra). But that is getting ahead of our knowledge base.
Test the above html code.
Continue on to next section (prelim2).
Return to the main book TOC.