Yahasp | 2 | WebReference

Yahasp | 2

Differences Between Yahasp and PerlHoo

The first and major difference is that if I sent a command


it would assume the yahasp.asp/computers/servers/unix was a directory NOT an executable file instead of yahasp.asp with input /computer/server/unix. To resolve this issue, I used the GET Method of posting a form that is passing a variable along with the URL. The final URL will look something like this:


To make it easier to complete the third requirement, I use the same command line variable to pass a flag that decides whether to display an input form or submit the form. Therefore, the final URL could look like this


To show the form or


to submit the form.

To decide whether to show a directory, the Form, or submit the form, I use a simple case statement that checks the Request "type" and calls the appropriate subroutine. I split the ASP into three separate subroutines. Normally I would have created three separate ASP files, but to emulate PerlHoo I kept the single file format.

Showing the Form

This is the simplest of all the parts. It is just simple HTML. The only complex line is 120. I use ASP Constants for the form submits action.

Submitting the Form

Those of you familiar with ASP have done this at least once, maybe to a database, maybe to a text file. The first step is to get the data (lines 144-148) using the Request Command (Note you could use the POST format in the form, and this would still work. There is some limitation to the GET Method, but for simplicity, I kept it with the GET Method). Line 150 is a line I normally use, I skipped it in the first routine, but it makes code easier to read.

Using the Scripting.FileSystemObject-OpenTextFile Method, I append the text file with the data passed in using the Write method. I then close the file. This is the same design as PERLHOO, as I use a standard text file that will be read by an administrator who will in turn choose to either add or not add the link. As Jonathan stated version III of PERLHOO would have an automated function, so too will version III of YAHASP.

The rest of the Submit form subroutine is standard HTML thanking the user as well as a simple table showing the user what he/she has input.


Written by Laurence Gold
Produced by Jonathan Eisenzopf and
Created: June 16, 1999
Revised: June 16, 1999

URL: http://www.webreference.com/perl/tutorial/4/