Online forms are the only source of user feedback that I know of on the WWW. There are two components to an online form: the html form and the program (perl script) to manipulate the form's data. This is a summary of how perl is used to manipulate information on the Invention and Design Homepage. Information is sumarized in a series of easy to use bullets.
First pick a template form, either id_comment.html (for generic comment forms, mails & stores response) or survey1.html (for class survey's, it just stores response ). Do the following:
Online forms are created using the forms tags. The best way to learn about creating online forms is to look at the html source of an online form. There is a simple relationship between the online form you see and the tags used to create that form. An online tutorial is available here.
Perl stands for Practical Extraction and Report Language. It is a scripting language for manipulating text, files, and processes usually on UNIX based machines. Only a bare minimum knowledge of Perl is necessary for manipulating the output of WWW forms. There is an online reference for Perl if you must really know more.
The Common Gateway Interface, or CGI, is a standard for external gateway programs to interface with information servers such as HTTP servers. Perl scripts use CGI to manipulate a form's information. In a nutshell, CGI gives us access to a series of variables containing information about and from a WWW page. Go to the CGI reference page when you need more information.
I have created three primary perl scripts available for information manipulation. These are located in the /home/meg3c/cgi-bin directory.
This is a perl script that will take the information from any form and mail it to a user or set of users. The form id_comment.html uses this form to return it's output. See the input type "hidden" tags in the source of id_comment.html to see how to set the receiver of the form information and the subject in the mailed message. Note also the form method=POST tag that tells you how to call this program, which has the following form /id/cgi-bin/response.cgi?file_name. File_name refers to the name of the file in which comments will be stored. The information page about response.cgi from the creator is available here . He calls it "form mailer."
This is a perl script that simply stores the results to a file instead of emailing them to someone. This is a simple modification of response.cgi. The survey form Spring 1994 Survey 1 uses this script to store it's information. In the source of survey1.html it is seen that the script is called from the form method post tag in the following form: /id/cgi-bin/survey_response.cgi?survey1 , indicating that the results will be stored as survey1.txt . Another text file can be created by calling survey_response.cgi?file_name_here . These text files are stored in the /home/meg3c/comments directory.
This is a perl script that processes the id_comment form. I used this form before I adopted the above more general approach. This is an example of how to write a perl script to more carefully process a specific form. It is no longer used.
The perl scripts are all located in the /home/meg3c/cgi-bin directory. They all have a .cgi attached to their name. To execute, a Perl file must be read and world executable. This is acheived by the command chmod a+rx *.cgi in the cgi-bin directory . You can see an example of how to call perl files in id_comment.html
Thorny Staples is the Perl guru down at the IATH. He can answer most Perl related questions. Dot Akinola will answer any questions relating to runing Perl from html forms. He was especially helpful to me.
I have run accross a few counter programs on my search of WWW stuff but few have worked with our setup on jefferson. The most promising counter I have seen is access counter available for free from Matt Kruse. It uses server-side includes which I could never get to work. Someone else may be able to get this to work with a little time and some pushing at the IATH.
Matt Kruse has made great strides in creating perl scripts for WWW use and making them available to the public. See this page for some more of his really neat scripts that might also be useful.
I am always availbe to answer more questions. Email me here .
Robert Heath