From: Marco Maggesi
Subject: cgi, databases and lisp
Date: 
Message-ID: <86iuh8zis1.fsf@visnu.math.unifi.it>
I am new to lisp.  I need to write dynamically generated html web
pages to access a relational database (this seems to be a quiet common
task in the every day work of many system administrator).  I do not
have to deal with a big amount of data (far less than one megabyte).
A typical example would be to store information like a list of names
of people, their addresses, phone numbers, etc. with some simple
relations.

For the moment I plan to write the system using php3 as apache module
to interface an mSQL database server. I have previous experiences with
these tools.

But this idea does not make me enthusiastic and I am wondering if a
more elegant and appropriate approach exists.  In particular:

  1. I would prefer to use some _real_ programming language. The
     system should be easy to maintain, modify and expand for future
     needs (as every experimental services). The possibility to give
     some abstraction while designing the system would be very
     desirable.

  2. I need flexibility over performance.  I do not have to deal with
     a huge amount of data: a sequential access made with a script in
     awk would certainly be fast enough to answer my queries.  A
     database server might not be the better choice as Lisp list would
     be certainly nicer than database query to deal with (like a very
     fast C program might be less useful than a frendly shell script
     made up with Unix text utils).

  3. I would prefer to use free software (mSQL is free for many
     purpose but not copyleft).

For these reasons I am considering to write the system in lisp.

Now my questions and perplexities (in decreasing order):

  1. The main doubt is about speedness: I do not need extreme
     performance, but I can not use cgi-bin processes that takes many
     seconds to take place. (I have tried guile but seems too slow to
     startup.  Subsequent calls of the interpreter on the instuction
     '(quit)' take more than one second each time on my pentium).

  2. Are there lisp dialects or implementations (or tools) preferable
     for this particular purpose over the others?

  3. Are there simple examples of cgi written in lisp I can look to
     start playing with?

  4. Many people insist that scripting languages like perl or tcl are
     easiest and more convenient for this kind of tasks. Do you think
     that lisp can be appropriate for my needs?


Sorry for my poor English.
Any suggestion is welcomed.

marco maggesi

From: Rainer Joswig
Subject: Re: cgi, databases and lisp
Date: 
Message-ID: <joswig-2510982134590001@194.163.195.67>
In article <··············@visnu.math.unifi.it>, Marco Maggesi
<·······@math.unifi.it> wrote:

> Now my questions and perplexities (in decreasing order):
> 
>   1. The main doubt is about speedness: I do not need extreme
>      performance, but I can not use cgi-bin processes that takes many
>      seconds to take place. (I have tried guile but seems too slow to
>      startup.  Subsequent calls of the interpreter on the instuction
>      '(quit)' take more than one second each time on my pentium).
> 
>   2. Are there lisp dialects or implementations (or tools) preferable
>      for this particular purpose over the others?
> 
>   3. Are there simple examples of cgi written in lisp I can look to
>      start playing with?
> 
>   4. Many people insist that scripting languages like perl or tcl are
>      easiest and more convenient for this kind of tasks. Do you think
>      that lisp can be appropriate for my needs?

Sure. We have been using SIOD.

-- 
http://www.lavielle.com/~joswig
From: Steve Gonedes
Subject: Re: cgi, databases and lisp
Date: 
Message-ID: <m27lxozauc.fsf@KludgeUnix.com>
Marco Maggesi <·······@math.unifi.it> writes:
 
< Now my questions and perplexities (in decreasing order):
< 
<   1. The main doubt is about speedness: I do not need extreme
<      performance, but I can not use cgi-bin processes that takes many
<      seconds to take place. (I have tried guile but seems too slow to
<      startup.  Subsequent calls of the interpreter on the instuction
<      '(quit)' take more than one second each time on my pentium).

The startup time for my lisp (acl 5 on linux/p6) is faster than the
startup time for my emacs, which is only a couple of seconds at the
most. I often exit the lisp and restart it while writing a program
(for various reasons) and it usually starts up immediately.

Still, you would probably be better off having the lisp sit on a
socket or something. It might be swapped to disk, but the wakeup time
would be faster and possibly more consistent. You can write a lisp
server in a couple lines of code, acl 5 comes with an example which is
less than 50 lines of code (if I remeber correctly). Also, most lisps
are multi-threaded so you could spawn new threads rather than new lisp
processes, which is much faster even with Copy On Write (especially
when you start to modify the process state).

<   2. Are there lisp dialects or implementations (or tools) preferable
<      for this particular purpose over the others?

I think common lisp is probably the best dialect, since you didn't
like scheme. Common lisp implementations usually compile to native
code and are not interpreted like guile which should result in a
faster running process.

There is a web-server written in common-lisp that you can use instead
of cgi, java, and apache, called cl-http. You can find pointers to it
on the ALU http://www.elwoodcorp.com/alu/index.htm. It is highly
recommened by those who use it (I have no need for a web server but
still find it fun to play with). If you go this route, then your
problem is solved as cl-http has been doing the dynamic HTML probably
more than a year before the media buzz-worded the phrase. Now,
"dynamic html" is a static program that runs in the web browser. Not
very dynamic imho.
 
<   4. Many people insist that scripting languages like perl or tcl are
<      easiest and more convenient for this kind of tasks. Do you think
<      that lisp can be appropriate for my needs?

Do you think lisp could be appropriate for your needs? In my case,
lisp has always been good with relations and such, never tried CGI
stuff though.