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

I want to create a completely local HTML,PERL,MySQL system. Do I need to install a web server? I have a win/98 machine with MySQL and Active PERL on it. I would like to create web pages that call PERL scripts that write data to MySQL database as I have on my web servers but I want it completely local.

Replies are listed 'Best First'.
Re: Non web system
by ikegami (Patriarch) on Aug 25, 2004 at 19:35 UTC

    To create web pages that call Perl scripts, you'll need to either have your web browser execute the perl script, or have a web server execute it (via CGI, for example).

    The former is possible in Windows using ActivateState's PerlScript (included in their perl distro, ActivePerl). PerlScript allows you to embed perl code in HTML pages in the same fashion as you would embed JavaScript code. Refer to the docs; communcation with the browser will be substantially different than with CGI.

Re: Non web system
by Zed_Lopez (Chaplain) on Aug 25, 2004 at 19:39 UTC

    Short answer: yes, you need a web server.

    Longer answer: well, no, you could write something else that duplicated much of the functionality of a web server that could act as the bridge between HTML files and Perl scripts... but why would you want to do that?

    Using Apache with Microsoft Windows

    Updated: ++ikegami -- I didn't think of PerlScript.

Re: Non web system
by chromatic (Archbishop) on Aug 25, 2004 at 19:41 UTC
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Non web system
by CountZero (Bishop) on Aug 25, 2004 at 19:49 UTC
    You could do without a web-server, but I find it too much work. Setting up an Apache webserver is no big deal. Have a look at Apachefriends where you can download fully functional Apache/(mod)Perl/MySQL all-in-one packages. You can set it up and run your own webserver/databaseserver in less than 5 minutes (more if you have a slow download link).

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Non web system
by dragonchild (Archbishop) on Aug 25, 2004 at 19:48 UTC
    I found and modified some code that allows a single webpage to pretend that it's a (stripped-down) webserver. I call it server-in-a-page. It uses PerlScript and only works with IE (as it uses some ActiveX magic and Microsoft's HTA technology). I could post it, if you want ... it's like 130 lines.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

      I would find it an interesting read, if you were to post it.
Re: Non web system
by idsfa (Vicar) on Aug 25, 2004 at 20:13 UTC

    The lynx web browser is capable of directly processing CGI scripts using the internal lynxcgi: protocol. While the referenced link indicates that it is only available on Unix, it does in fact work under CygWin. Of course, the binary packaged by CygWin is not compiled with that option, so you would have to compile it up from scratch -- but if you are that set on not having a web server involved, it's an option.


    If anyone needs me I'll be in the Angry Dome.
Re: Non web system
by xorl (Deacon) on Aug 25, 2004 at 19:39 UTC
    If you want it to serve webpages, yes you need to install a webserver. Last time I had Win98 there was something called Personal Web Server (PWS) which worked ok for something by Microsoft. I'd recomend installing Apache (http://httpd.apache.org/docs/windows.html) or whatever webserver your other webservers have. Ideally your development/test/local box will be identical to the production servers.
Re: Non web system
by Wassercrats (Initiate) on Aug 25, 2004 at 19:49 UTC