jeffpflueger has asked for the wisdom of the Perl Monks concerning the following question:

I've done all of my running and testing of Perl scripts on a remote server via a request from a browser on my local machine....works fine, though it is cumbersome....having to upload stuff constantly, etc, etc. Is there a good way to do this all on my local computer? To send the Perl script outputted HTML to a browser locally, and thereby set up my own little mock CGI?

Any help would be great. Thank you. Jeff

  • Comment on Mock CGI output to browser from Perl on Windows 98

Replies are listed 'Best First'.
(ichimunki) Re: Mock CGI output to browser from Perl on Windows 98
by ichimunki (Priest) on Dec 19, 2001 at 22:48 UTC
    Yes, you can set up your local machine as a web server, but you'll need to install some server software: looks like apache has a Win32 offering.

    You can also run your CGI from the command line and have the script output to an HTML file rather than to STDOUT, but this isn't quite the same (although it can be a good technique for building a large static site).
      Actually the last thing is quite a good one, may be archaic but I do it quite often while testing code for work. just run your code on the command line like this :
      bash$>./perlmonksrule.pl "paramname=paramvalue&paramname2=paramvalue2"
      You are basically passing the code's STDIN exactly what apache sees and then inturn passes to your STDIN to be parsed my your CGI.pm.
      I'd also recommend xitami as a simple web server for testing cgi. It's less than a meg to download. It comes almost completely setup for quick and simple operation with cgi-bin directory all set up and ready to go.

      You can get it off download.com

      Just do a search for Xitami. Very handy.
Re: Mock CGI output to browser from Perl on Windows 98
by dws (Chancellor) on Dec 19, 2001 at 23:03 UTC
    Is there a good way to do this all on my local computer? To send the Perl script outputted HTML to a browser locally, and thereby set up my own little mock CGI?

    I do a lot of personal CGI development on my Win98 laptop using ActiveState Perl and Microsoft's Personal Web Server (PWS). Much of that work later gets uploaded to a FreeBSD box running Apache. It works well for me for simple stuff. (For MySQL development, I stick with FreeBSD.)

    PWS is a scaled-down version of IIS. It supports Perl CGIs just fine, with the standard caveats that some things like fork and flock don't work on Win98. (It's been a couple of years since I installed it, and I don't remember if it's on the Win98 CD or the Option Pack CD.)

    I posted some advice here about getting PWS working with ActiveState Perl.

    Another alternative is Apache. I've gotten Apache to work with Perl CGIs on NT, but have no experience with it on Win98.

Re: Mock CGI output to browser from Perl on Windows 98
by TGI (Parson) on Dec 19, 2001 at 23:52 UTC

    Indigo Perl comes with an Apache server preconfigured for mod_perl and CGI. I often use it to test CGIs.

    It has its own package management system that is compatible with Active State's PPM system.


    TGI says moo

How about Protozilla
by nufsaid (Beadle) on Dec 20, 2001 at 02:28 UTC
    Check out Protozilla !

    Among other things it claims to be able to do client side CGI and at the link above specifically states:

    This feature may be useful for testing CGI programs

    Joe.