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

I have installed ActivePerl on my WindowsXP system and I want to write and test some scripts, but I don't have a web server to run them on. Is there a way to run a CGI script locally in a browser without a web server? I suppose I could download Apache and turn my PC into a web server, but that seems like a lot of fuss just to test-run some Perl scripts.

Any attempt I've made to manually point my browser to the perl executable results in a file download dialogue. So is there a way to tell the browser to execute the script without server attributes?

Replies are listed 'Best First'.
Re: Testing scripts without a server
by BUU (Prior) on Mar 17, 2004 at 03:50 UTC
    Well, if you're using CGI.pm (which you probably should be), you can simply run your scripts from the command line, passing url params in via the command line. CGI.pm will automatically parse @argv and pretend it's a query string. Beyond that however, just install a webserver. It's dead easy. You can download apache and be running in probably under 10 minutes.
Re: Testing scripts without a server
by davido (Cardinal) on Mar 17, 2004 at 07:23 UTC
    Is there anything preventing you from installing Apache Webserver on your WinXP system? That's what I've done for preliminary testing of CGI stuff.

    The first problem that you're likely to run into with this sort of solution is that it's probable that your remote webserver isn't running WinXP (probably Linux), and thus, you will have to pay attention to remaining operating-system portable.

    But keeping that in mind, you can still do a lot of testing just by installing apache webserver on your system. It's free, by the way.


    Dave

Re: Testing scripts without a server
by Wampa (Hermit) on Mar 17, 2004 at 07:27 UTC

    Easy way to install Apache with perl is download this file http://apache.tuke.sk/perl/win32-bin/Perl-5.8-win32-bin.exe and install. Install and work. This instalation include of Perl-5.8.3 and Apache 2.0.48. I use it on WinXP and I dont have any problems. Work perfectly.

    Programing in Embperl and all questions are related to Embperl.
    Excuse my bad English !!!
Re: Testing scripts without a server
by crabbdean (Pilgrim) on Mar 17, 2004 at 02:55 UTC
Re: Testing scripts without a server
by mawe (Hermit) on Mar 17, 2004 at 11:01 UTC
    Hi!

    If you don't want to install Apache, take any other web-server. You can find lots of them on Freshmeat. I use Ranquel, which is very small and written in Perl. Have fun!

Re: Testing scripts without a server
by wolfi (Scribe) on Mar 17, 2004 at 06:12 UTC
    i haven't used cgi.pm or indigoperl in that manner before, so i can't say, how well they'd work. Otherwise to my knowledge - no. The browser will usually either view it as a textfile or a downloadable.

    i know, you don't wanna try the server route - but i can't resist saying this -> i run a localhost apache on my xp - and it's saved me more time and made things more easier for webdev and learning perl, than you can possibly believe. Seriously.

    Like BUU suggested - get one. You won't regret it.
    ps: ActivePerl works really well on Apache, too.