Adding a Simple Quote Generator To Your Web Page:
( How To Configure Windows XP Pro Service Pack 2, IIS 5.1, and Dreamweaver MX to use Perl Scripts at 4:37 a.m.)

I'm running Windows XP Pro (Service Pack 2) with IIS 5.1 using DreamWeaver to host my own website locally. I wanted to add a "simple" random quote generator to my web page. However, this is a little be more complicated than anything I've tried to set up using Dreamweaver to date. Up to this point, I've been basically serving up bland HTML web pages to the servile masses, but I figured nothing ventured nothing gained and I was off to the races.

So, I was kinda flying blind. I Googled the net for a random quote generator and found a Perl script, and figured I'd try to get that working. However, in the process, I learned a few things:

  1. You need to install Perl, but before you go changing anything, it's always a good idea to create a checkpoint backup under XP. Go to Start - Programs - Accessories - System Tools - System Restore and Create a Restore Point. Then install Perl. The best way to go seems to be to install ActivePerl, a decent free Perl interpreter for Windows. Download ActivePerl from http://activestate.com/Products/Download/Register.plex?id=ActivePerl

    Contact information is not required. Just click on Next. I selected the MSI package of ActivePerl for Windows version 5.8.6. During the ActivePerl install, you will be asked whether to set up an IIS mapping to the *.pl extension. Choose Yes (default). I installed with all default values. Just click next until it installs.

    To verify that Perl is working, go to Start - Run and type in Command to get to the DOS prompt.

    Attempt to execute the script:

    c:\inetpub\perl\src\quote.pl

    This should work, at this point.

    I had to add the .cgi file association. So, I allowed it to pick from a list and pointed it to Perl.exe. Then, I went into Windows Explorer - Tools - Folder Options - File Types - Select the CGI file type, click Advanced button, highlite Open action and click on Edit and change "Application used to perform Action" to:

    "C:\Perl\bin\perl.exe" "%s" %s

    This broke it good .Now it says "Can't open perl script "1": No such file or directory.

    So, I changed it back to "C:\Perl\bin\perl.exe" "%1" %*

It actually works fine this way. So, I have .cgi and .pl scripts working from the command prompt.

  1. Now, we have to configure it to work for IIS 5.1.

    Click on Start - Run and enter "Inetmgr" and it will launch the IIS manager.

    In the Home Directory, click the "Create" button. It populates the "Application Name" field with "Default Application". You may want to change the "Execute Permissions" from "Scripts" to "Scripts and Executables". HOwever, in the end, I left mine at "Scripts" instead of "Scripts and Executables". The reason for this is that I have a lot of self-playing slideshows on my web page that are .exe files. When I selected "Scripts and Executables", it was letting IIS try to run the .exe files locally. So, whenever someone came in and clicked on my web site, I'd hear the music start playing and they didn't get their download. So, this was confusing to me and to them. In the end, I left it at "Scripts", because I'm only using .PL scripts any way. It's technically an interpreter language, and isn't really an "Executable". Clicking on Create also enables the "Configuration" button. Click on the "Configuration" button. You should see the .pl and .cgi extension mapping as "c:\perl\bin\perl.exe %s %s". If not, then add them manually. NOTE: The "%s %s" is case-sensitive (for example, "%S %S" does not work).

  2. For Extension, type .pl., make sure that the All Verbs option is selected for full functionality, and that the Script Engine check box is selected.

    Click Apply, and then at the Inheritance Override, click on Select All - OK to apply these permission changes to all child nodes.

Here's Microsoft's take on getting IIS 5.1 to work with Perl.

The changes should occur immediately. There is no need to reboot or restart IIS.

I copied my default scripts directory up to be under wwwroot and put my .pl and .cgi scripts in this directory. Now, the scripts should be accessible remotely as http://wepage/script/helloworld.pl

You can click on my retarded little test scripts and watch them run below:

Hello World

Random Quote

OK, So, now I have IIS working with Perl Scripts. :)

  1. Now, I have to figure out how to call (execute) these scripts from within my html, ideally to create dynamic html on the fly. I found a couple of links where people purported to have Dreamweaver MX working with Perl.

    "Configure Dreamweaver MX to work with Perl. Macromedia has added an extension to support Perl."

    http://www.macromedia.com/cfusion/exchange/index.cfm?view=sn121&extID=1021086 I installed this one successfully. It didn't really help any, so far as I could tell, but it didn't hurt either, which usually the best you can hope for at 4:37 in the morning.

    http://www.macromedia.com/cfusion/exchange/index.cfm?view=sn121&extID=231980 ( I don't recommend installing this one. I got errors after installing it and had to uninstall it, which wasn't as painless as I'd hoped because Windows was using the JavaScript extension, so I had to shut down Dreamweaver just to get it uninstalled properly through the extension manager. Possibly, my problem was that I had the wrong release of Perl, as it said I needed 5.6.1, and I definitely don't have that release. I was hoping it would work anyway, and it didn't. This extension was released about 3 years ago, though, so I'm not clear how relevant it is at this point in any event.

  2. My ultimate goal in all of this was to be able to create my own random quote generator. Unfortunately, I began to fear that I never would get the Perl script to function as a quote generator. The problem was that, although I could get the Perl script to run under IIS and XP, I couldn't figure out how to execute it and display the results in my web page. Initially, I assumed that I needed to create a Dynamic Page with a "Document Type" of Perl in Dreamweaver. In the end, I decided that this was probably not possible. Also, the Perl script I found appears to include Server Side Includes(SSI's), which appear to be unique to Unix. I couldn't figure out how to execute the Perl script in a manner that was feasible. I was on the scrapping any further attempts to use Perl scripts. To further complicate things, Perl seems to be only very thinly supported and used in the Windows environment and 90% of the articles and programs related to Perl assume you're running it under Linux.

    Eventually, after much surfing and scanning of html code, I realized that, through the miracle of HTML, I could execute my custom Perl script and display the resulting text string in an I-frame in a table. The Perl script that I ended up using was a modified version of this one http://sedition.com/perl/random-quote-cgi.html .

Challenges Dealing with Perl

I realized the following things in my attempt to use Perl scripts to generate dynamic html on my web page:

  1. I was never able to get Macromedia Dreamweaver MX to create a new Dynamic Page with a Document Type of "Perl". So, I don't think this is possible.
  2. Most examples of Perl execution invoke "Server Side Includes" (SSI's), that are probably unique to Unix, which I'm not running.
  3. 90% of the documents related to Perl assume you're using Linux, Apache, MySql, and Perl(LAMP). So, it's challenging to get Perl to work under an XP O/S, running IIS and Dreamweaver.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Below are some Links(probably broken) that I found helpful. (Please don't report broken links to me. I really don't care.) I figured all of this out on my own in a matter of hours. If you can't figure it out, it doesn't mean that you're stupid, but signs do tend to point in that general direction.

http://activestate.com/Products/Download/Register.plex?id=ActivePerl

http://support.microsoft.com/kb/q245225/

http://home.wangjianshuo.com/archives/20021124_install_perl_on_windows_xp.htm

http://www.xav.com/scripts/installer/3057.html

http://sedition.com/perl/random-quote-cgi.html

http://www.iisanswers.com/Top10FAQ/t10-installperl.htm