Perl Primer - helpful hints for using Active State Perl with Personal Web Server (Win95, Win98, NT Workstation).

Install Active State Perl per the instructions that come with your version. That normally installs Perl to the directory c:\Perl. The executables are in c:\Perl\bin. The installer does a good job of setting up Perl. The following concentrate on the things needed for PWS to work with Perl.

The Registry

PWS needs to be able to find the perl executable so it can run your perl programs. PWS looks in the registry entry:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\W3SVC\Parameters\Script Map
for the location of the perl executable.

Note: I always use perlis.dll as the Perl executable for PWS. Perlis.dll should have been included when you loaded Perl. The advantage of perlis.dll is that it uses less resources and is faster than perl.exe. Also, the registry entries are simpler.

Here are the registry entries that you need:

perlReg.gif (10464 bytes)

All extensions with the same data value are equivalent.

Here is a registry script to make these entries. Copy the following lines (beginning with REGEDIT4) to a text file and name it perlparm.reg. Import the file with regedit.exe. ALWAYS BACKUP THE REGISTRY BEFORE YOU MAKE ANY CHANGES!

REGEDIT4

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\W3SVC\Parameters\Script Map]
".pl"="c:\\perl\\bin\\perlis.dll"
".cgi"="c:\\perl\\bin\\perlis.dll"
".plx"="c:\\perl\\bin\\perlis.dll"

ALWAYS restart after editing the registry! Note that entries are only required for the file extensions you intend to use for your perl programs.

PERSONAL WEB MANAGEMENT

PWS needs a virtual directory set up with the proper permissions for your perl programs. This is done in Personal Web Manager (the "Publish" icon on your desktop).

PWM0.gif (19678 bytes)

The following is for PWS with the home directory set to d:\inetpub\wwwroot as shown above. If your PWS home directory is different, you will need to make the obvious changes to the following instructions.

Clickt the "Advanced" button.

PWM1.gif (19678 bytes)

You should have a "/cgi-bin" virtual directory directly under the "<Home>" directory. If so, check it's pproperties with the "Edit Properties ..." button. If you don't have this directory, add it with the "Add" button.

The next screen shows the properties you need:

PWM2.gif (19678 bytes)

That should be everything that is needed. You should now be able to put a CGI program into the cgi-bin directory and run it by browsing to http://localhost/cgi-bin/<program>.pl. Here are links to two test files that you can use to test your implementation. CAUTION: Don't try to run them from here or copy them from the screen. Right click on the links and save them to your "?:\inetpub\wwwroot\cgi-bin" directory as either .pl or .cgi files.

test.txt Save this file as test.pl (or test.cgi) in your cgi-bin directory.

ev.txt Save this file as ev.pl (or ev.cgi) in your cgi-bin directory.

Test.pl will display "Hello World" in Header2 type centered between two horizontal rules. If it does you have correctly set up Perl for PWS.

Ev.pl will display a nicely formatted list of your environment variables.

Copyright © by J. E. Rickenbacker. All rights reserved.

4-24-02