Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Learning CGI

by dmckee (Scribe)
on Jan 05, 2001 at 02:34 UTC ( #49893=perlquestion: print w/replies, xml ) Need Help??
dmckee has asked for the wisdom of the Perl Monks concerning the following question:

I have a very simple problem - it's almost not Perl related, but I don't know where else to ask.
I'm trying to write some very simple CGI scripts, but want to develop them without a live internet connection on Windows '98. What's the best way of doing this (if it is possible at all)?
-- Dave

Replies are listed 'Best First'.
(Ovid) Re: Learning CGI
by Ovid (Cardinal) on Jan 05, 2001 at 03:12 UTC
    Personally, I'd install Apache on my box and use that. I wrote up a little tutorial for Setting up Perl/CGI with Windows, since it's a common enough question. It's not so much a tutorial, though, as a step-by-step "hand-holding" for getting your Web server up and running.

    Read through that and if you have problems, let us know.


    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Re: Learning CGI
by Hot Pastrami (Monk) on Jan 05, 2001 at 02:35 UTC
    Download the Win32 version of Apache webserver from Once installed and running, pointing your browser to "localhost" will view the site on your own PC.

    Hot Pastrami
Re: Learning CGI
by chromatic (Archbishop) on Jan 05, 2001 at 02:56 UTC
    Jellybean is a portable, pure-Perl application that can serve CGI scripts even on a Windows box. It's easier to set up than Apache.

    However, it's not well-tested under Windows.

Re: Learning CGI
by ryddler (Monk) on Jan 05, 2001 at 03:39 UTC

    Personal Web Server (PWS) is also available for use on Win9x and NT. It is a version of Internet Information Server 4.0 (IIS) and you should be able to find it on your Win98 installation cd.

    Once you have PWS installed on your machine, you need to either modify the registry key:


    "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\W3SVC\Parameters\Script Map"

    to add a new string value(s) with the name(s):

    .pl and/or .cgi

    with the value:

    c:\perl\bin\perl.exe -T %s %s


    D/L the snippet below, save it with the extension .reg, and merge it into your registry by double-clicking it. If the "open with" dialog pops up choose "regedit" as the program to "open with"

    REGEDIT4 [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\W3SVC\Parameters +\Script Map] ".cgi"="c:\\perl\\bin\\perl.exe -T %s %s" ".pl"="c:\\perl\\bin\\perl.exe -T %s %s"
    Update: Added "-T" to the above snippets as Ovid mentioned below. (Now I better go investigate Taint ;)

      Your solution is fine, but the problem is, CGI scripts should be run with Taint mode enabled. Unfortunately, you have to pass the -T switch to the perl executable when it's started. You can't use it afterwards or else you'll get a "Too late for -T switch" error and the script will die. To solve that, the value should be set to:
      c:\perl\bin\perl.exe -T %s %s
      Or the appropriate lines in the snippet should read
      ".cgi"="c:\\perl\\bin\\perl.exe -T %s %s" ".pl"="c:\\perl\\bin\\perl.exe -T %s %s"
      If anyone knows how to enable Taint mode after the perl executable has already been started, please speak up! I would be very happy to know that I am wrong.


      Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Re (tilly) 1: Learning CGI
by tilly (Archbishop) on Jan 05, 2001 at 06:30 UTC
    I have recommended Xitami for this in the past. Small, easy to set up and configure, stable, and it implements the CGI spec properly.

    If you have experience with another, by all means use it. But for a simple learning tool...

      And (see perl news) there's IndigoPerl a win32 release that includes Apache. YMMV


Re: Learning CGI
by wardk (Deacon) on Jan 05, 2001 at 03:59 UTC

    In the spirit of TIMTOWTDI

    It's doing things the (somewhat) hard way, but will let you pass all your query_string to a CGI script at the command line, even on windows 98.

    Create a batch file to automate it, and pipe the output to a file, then point your browser at the file.

    This is most certainly a proof that Perl makes the "difficult possible"!

    Good luck!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://49893]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2017-02-21 22:58 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (321 votes). Check out past polls.