Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

Comment on Learning CGI
Re: Learning CGI
by Hot Pastrami (Monk) on Jan 05, 2001 at 02:35 UTC
    Download the Win32 version of Apache webserver from www.apache.org. 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.

(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.

    Cheers,
    Ovid

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

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:

    WARNING! DO NOT EDIT THE REGISTRY IF YOU DO NOT UNDERSTAND WHAT YOU ARE DOING!!!

    "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

    Or...

    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 ;)

    ryddler
      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.

      Cheers,
      Ovid

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

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 CGI.pm 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!

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

      a

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://49893]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2014-08-30 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls