From: Emre Sevinc
Subject: Lisp and Web Programming
Date: 
Message-ID: <874qcflfur.fsf@ileriseviye.org>
A friend asks:

"Hi,

I am trying to write a simple web application in Common Lisp. The first
problem was to interact with a database server. Thanks to Haldun
Bayhantopcu's help, it is OK using CMUCL + CommonSQL.

The second problem is that CommonSQL has support for only few Common
Lisp interpreters and compilers. And those supported free ones does
interestingly not support Shebang Characters for CGI execution. Thus I
tried using modlisp for apache but that does not work as smooth as I
expected.

Does anyone has an opinion to cope with these problems? Once I get a
simple "Hello World" web page through (format t "Hello World~%"), then
everything will be simpler.

vst"

Any suggestions?

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr

From: Fred Gilham
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <u7vf4vphaf.fsf@fury.csl.sri.com>
> The second problem is that CommonSQL has support for only few Common
> Lisp interpreters and compilers. And those supported free ones does
> interestingly not support Shebang Characters for CGI execution. Thus
> I tried using modlisp for apache but that does not work as smooth as
> I expected.

If you google for Rob Warnock's postings to comp.lang.lisp you'll see
that he has a method for dealing with this with CMU Lisp.  I suspect
and hope that he will chime in shortly anyway. :-)

-- 
Fred Gilham                                         ······@csl.sri.com
Central bankers don't trust each other. They know how easy it is to
create money out of nothing. They hold dollar-denominated assets, such
as U.S. Treasury-bills, because they can earn interest --- not much
these days --- but they settle their final accounts with each other in
gold.                                                   --- Gary North
From: Rob Warnock
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <n8adne4p2Y1-_C_fRVn-og@speakeasy.net>
Fred Gilham <······@fury.csl.sri.com> wrote:
+---------------
| Emre Sevinc <·····@bilgi.edu.tr> wrote [or forwarded for a friend]:
| > The second problem is that CommonSQL has support for only few Common
| > Lisp interpreters and compilers. And those supported free ones does
| > interestingly not support Shebang Characters for CGI execution. Thus
| > I tried using modlisp for apache but that does not work as smooth as
| > I expected.
| 
| If you google for Rob Warnock's postings to comp.lang.lisp you'll see
| that he has a method for dealing with this with CMU Lisp.  I suspect
| and hope that he will chime in shortly anyway. :-)
+---------------

There have been many other useful answers in the past two weeks,
so I'll try not to duplicate their excellent advice, but here are
a few comments anyway specifically for the CMUCL environment:

1. If you're running on an operating system that supports more
   than one additional argument on a "#!" (e.g., FreeBSD), one
   of the ways to use CMUCL for CGI is to build an application-
   specific core image containing all of your CGI support & query-
   parsing & HTML-generation tools [whichever of the many excellent
   libraries you use]. You do this by loading all the stuff into
   a fresh CMUCL image and then use the function EXTENSIONS:SAVE-LISP
   to write out the image, specifying in the call a CGI application
   start-up function you've written (which just loads the CGI script,
   basically) that replaces the normal LISP::%TOP-LEVEL function, e.g.:

       ;; Build the core & exit
       (save-lisp "cgi.core"
		  :init-function #'cgi-init-function
		  :load-init-file nil          ; same as "-noinit"
		  :print-herald nil            ; same as CLISP's "-q"
		  )

   Then you can start your CGI script with:

       #!/usr/local/bin/cmucl -core /usr/local/lib/cmucl/lib/cgi.core

   Look at the "config.lisp" file in the CMUCL distribution for an
   example of saving a core, then tweak away. For a live example of
   CGI scripting with it, see <http://rpw3.org/hacks/lisp/cmucl-demo.cgi>.

   [Also see <http://rpw3.org/hacks/lisp/clisp-demo.cgi> for the
   same thing done with CLISP.]

   NOTE: Despite the above, I no longer recommend this method. [See #2.]

2. Some of the objections to useing "mod_lisp" seemed to be along
   the lines of "But I don't control [the configuration of] my web
   server!" or "But what if the locally-available web server isn't
   Apache?". Well, besides FastCGI and selective HTTP-proxying (which
   Araneida can use behind Apache, for example) which others have
   already mentioned, you can write a *tiny* little C-based CGI program
   that just opens a socket [preferably a local Unix-domain socket,
   for security] to your persistent Lisp-based server [CMUCL or other]
   and passes it *EXACTLY* the same information that "mod_lisp" would
   pass it. That way, you can run your Lisp app behind *any* web server
   that supports CGI, but get (most of) the performance benefit of
   using "mod_lisp"... *and* be all set for the day the web server
   admin decides to allow you to install "mod_lisp" itself!

   I did that [mainly because of that web server admin issue], and
   called it "cgi_sock.c"; the executable is "sock.cgi" [so it doesn't
   have to be in /cgi-bin/, if the server has "*.cgi" enabled]. It's
   about 200 lines of C, but is that big only because it handles both
   GET & POST requests, and also contains a nice little compiled-in
   HTML error message that it serves up if there's any problem in
   connecting to the Lisp server socket.

   On a 1.4 Gz Athlon running FreeBSD, with Apache 1.3.26 executing
   it and with CMUCL-19a on the other end of the socket, "ab -n100"
   reports ~70 requests/sec for a simple "env.lhp" (Lisp-Handled Pages)
   that dumps the environment. [See <http://rpw3.org/env.lhp>, but
   please don't run perf tests; you'll eat my poor DSL line alive!]

   For comparison, a simple Perl-based "printenv" gets ~125 req/sec,
   and a /bin/sh script that just calls "env" gets ~175 req/sec.

   With "mod_lisp" you could probably get >200 such trivial reqs/sec,
   but for the apps I use "sock.cgi" for, even *1* req/sec is overkill.
   So it's quite "good enough" for my needs.

   [Compare the LHP version of <http://rpw3.org/hacks/lisp/appsrv-demo.lhp>
   to the above CGI examples. Note that ".lhp" pages can be just source,
   or compiled (this one is), and in either case are cached by the server
   for speed.]

To either method #1 or #2, add Tim Bradshaw's HTOUT or Edi Weitz's
CL-WHO for HTML generation, Eric Marsden's PG to talk to PostgreSQL,
and maybe Kevin Rosenberg's CL-MODLISP for the Lisp server front-end
(I had already written mine when CL-MODLISP appeared), and you have
a very nice web application environment.

3. Not for web/CGI per se, but just for basic "CL scripting", I hacked
   up "/usr/local/lib/cmucl/lib/site-init.lisp" [which gets run *before*
   the command-line switches are parsed!] to look for a new "-script"
   option, so you can say stuff like this:

       % cat ./test
       #!/usr/local/bin/cmucl -script
       (format t "hello world!~%")
       (loop for i from 1
	     and arg in *script-args*
	 do (format t "arg#~d = ~s~%" i arg))

       % ./test foo bar
       hello world!
       arg#1 = "foo"
       arg#2 = "bar"
       % 

   On that same 1.4 Gz Athlon under FreeBSD, that takes ~20 ms. to run,
   using an *unmodified* CMUCL-19a "lisp.core".  [Though note that
   to get the speed that low, I had to compile the "site-init.lisp"!
   And that time also assumes some other process on the system is
   also using (or has recently used) "lisp.core".]

   The same hack also supports concatenating "#!/usr/local/bin/cmucl -fasl"
   onto the front of a CMUCL ".x86f" file, for when the "script" starts
   getting too large to run fast enough when interpreted.

   [Yes, this *can* also be used for CGI scripting, but it's not as
   efficient as a CGI-specific core image (and *definitely* much
   less efficient than a persistent Lisp server daemon!), since with
   the "-script" approach you have to keep reloading your CGI/HTML/SQL
   libraries each time. Ugh.]


-Rob

p.s. By the way, my apologies to the community for not having yet
made "cgi_sock.c" [and the "cl-modlisp"-like code that it talks to]
and the "site-init.lisp" "-script/-fasl" hacks generally available.
There seems to be a shortage of those round "tuit"s lately...

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: ············@gmail.com
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1117821721.964049.91690@g43g2000cwa.googlegroups.com>
> Does anyone has an opinion to cope with these problems? Once I get a
> simple "Hello World" web page through (format t "Hello World~%"), then
> everything will be simpler.
>

Common Lisp is such a great language that it does not need standard
libraries. Everyone can write anything easily. I needed simple CGI too,
so here is the one I cooked over the last weekend. Uses rfc2388,
slightly hacked and fixed, and port (see README.txt) inside. Supports
GET, POST/urlencode, POST/multipart. Runs with and includes examples
for CLISP, CMUCL, Lispworks, OpenMCL.

http://ftp.davidashen.net/misc/cgi.zip

David
From: Edi Weitz
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <uis0vig3k.fsf@agharta.de>
On Fri, 03 Jun 2005 16:39:08 +0300, Emre Sevinc <·····@bilgi.edu.tr> wrote:

> A friend asks:
>
> "Hi,
>
> I am trying to write a simple web application in Common Lisp. The
> first problem was to interact with a database server. Thanks to
> Haldun Bayhantopcu's help, it is OK using CMUCL + CommonSQL.

CommonSQL is only available for LispWorks.  Maybe he's using
UncommonSQL but if that's the case he should switch to CLSQL.  (CLSQL
is a superset of UncommonSQL and the latter isn't maintained anymore.)

> The second problem is that CommonSQL has support for only few Common
> Lisp interpreters and compilers.

Only a few?  Which one are you missing?

  <http://clsql.b9.com/platforms.html>

J�rg H�hle has just announced preliminary support for the CLSQL/CLISP
combo.

> And those supported free ones does interestingly not support Shebang
> Characters for CGI execution.

See Fred Gilham's reply.  You could also use FastCGI with CMUCL:

  <http://www.cliki.net/FastCGI>

> Thus I tried using modlisp for apache but that does not work as
> smooth as I expected.
>
> Does anyone has an opinion to cope with these problems? Once I get a
> simple "Hello World" web page through (format t "Hello World~%"),
> then everything will be simpler.

Try (shameless self-plug) TBNL - maybe it's easier to use than "raw"
mod_lisp.  (In fact, you don't have to use Apache/mod_lisp at all.)

  <http://weitz.de/tbnl/>

Cheers,
Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: theo doukas
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <d7qv5t$jrv$1@newsreader3.netcologne.de>
Edi Weitz wrote:
> On Fri, 03 Jun 2005 16:39:08 +0300, Emre Sevinc <·····@bilgi.edu.tr> wrote:
> 
> 
>>A friend asks:
>>
>>"Hi,
>>
>>I am trying to write a simple web application in Common Lisp. The
>>first problem was to interact with a database server. Thanks to
>>Haldun Bayhantopcu's help, it is OK using CMUCL + CommonSQL.
> 
> 
> CommonSQL is only available for LispWorks.  Maybe he's using
> UncommonSQL but if that's the case he should switch to CLSQL.  (CLSQL
> is a superset of UncommonSQL and the latter isn't maintained anymore.)
> 
> 
>>The second problem is that CommonSQL has support for only few Common
>>Lisp interpreters and compilers.
> 
> 
> Only a few?  Which one are you missing?
> 
>   <http://clsql.b9.com/platforms.html>
> 
> J�rg H�hle has just announced preliminary support for the CLSQL/CLISP
> combo.
> 
> 

If it is a viable way for you to go, implementing some FFI bindings for 
libmysqlclient.so is not a big deal. The library is laid out well enough 
that the you can practically port the C functions 1:1 to lisp functions. 
    I'm using CLISP myself along with a few handmade MySQL FFI bindings 
and it works allright.
From: Vehbi Sinan Tunalioglu
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <3ggl5vFc2pvfU1@individual.net>
Edi Weitz wrote:
>>A friend asks:

It was me who asked for it...

> CommonSQL is only available for LispWorks.  Maybe he's using
> UncommonSQL but if that's the case he should switch to CLSQL.  (CLSQL
> is a superset of UncommonSQL and the latter isn't maintained anymore.)

You are right, I was using CLSQL, not CommonSQL.

> 
>>The second problem is that CommonSQL has support for only few Common
>>Lisp interpreters and compilers.
> 
> 
> Only a few?  Which one are you missing?

Actully, CLISP is the one I was seeking for. Because, using CLISP, I
could use Shebang and start easily to program.

> 
> 
> See Fred Gilham's reply.  You could also use FastCGI with CMUCL:
> 
>   <http://www.cliki.net/FastCGI>
> ...
> Try (shameless self-plug) TBNL - maybe it's easier to use than "raw"
> mod_lisp.  (In fact, you don't have to use Apache/mod_lisp at all.)
> 
>   <http://weitz.de/tbnl/>

I checked TBNL and UCW... The reason that I hesitate to select one of
the proposed ways of web programming in Common Lisp is that everything
might become messy one day, when I work on a big web site. I want to
switch to Common Lisp. And as far as I understand, I won't feel alone if
I will use TBNL or UCW. Am I right?

--vst
From: Stefan Scholl
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <mn3gk8yg3180$.dlg@parsec.no-spoon.de>
On 2005-06-05 17:47:27, Vehbi Sinan Tunalioglu wrote:

> Actully, CLISP is the one I was seeking for. Because, using CLISP, I
> could use Shebang and start easily to program.

See http://www.cliki.net/CMUCL%20Hints on how to do this with CMUCL.

-- 
Web: http://www.no-spoon.de/ -*- IRC: stesch @ freenode
From: Emre Sevinc
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <87d5r0oe1o.fsf@ileriseviye.org>
Vehbi Sinan Tunalioglu <···@vsthost.com> writes:

> Edi Weitz wrote:
>>>A friend asks:
>
> It was me who asked for it...

Welcom to comp.lang.lisp! :)


>> CommonSQL is only available for LispWorks.  Maybe he's using
>> UncommonSQL but if that's the case he should switch to CLSQL.  (CLSQL
>> is a superset of UncommonSQL and the latter isn't maintained anymore.)
>
> You are right, I was using CLSQL, not CommonSQL.
>
>> 
>> See Fred Gilham's reply.  You could also use FastCGI with CMUCL:
>> 
>>   <http://www.cliki.net/FastCGI>
>> ...
>> Try (shameless self-plug) TBNL - maybe it's easier to use than "raw"
>> mod_lisp.  (In fact, you don't have to use Apache/mod_lisp at all.)
>> 
>>   <http://weitz.de/tbnl/>
>
> I checked TBNL and UCW... The reason that I hesitate to select one of
> the proposed ways of web programming in Common Lisp is that everything
> might become messy one day, when I work on a big web site. I want to
> switch to Common Lisp. And as far as I understand, I won't feel alone if
> I will use TBNL or UCW. Am I right?

I share similar concerns. I believe the one with better docs., faster
and wider community support, the one which is more extensible, the one
which includes more bells and whistles should be chosen. The only
problem is, how to find out which one is so ;-)


-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: drewc
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <4p1oe.1563138$8l.1043499@pd7tw1no>
Emre Sevinc wrote:
> A friend asks:
> 

> Does anyone has an opinion to cope with these problems? Once I get a
> simple "Hello World" web page through (format t "Hello World~%"), then
> everything will be simpler.

You don't want to use CGI at .. trust me : .. CGI is a hack at best.

http://lisp.tech.coop/Web%20Programming lists some resources for web 
programming in CL .. i strongly suggest using UCW or TBNL with either 
mod_lisp or aranieda ... you'll never even thing about CGI and hash-bang 
again :


drewc


> 
> vst"
> 
> Any suggestions?
> 


-- 
Drew Crampsie
drewc at tech dot coop
"Never mind the bollocks -- here's the sexp's tools."
	-- Karl A. Krueger on comp.lang.lisp
From: ············@gmail.com
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1117880057.455563.83190@g49g2000cwa.googlegroups.com>
> You don't want to use CGI at .. trust me : .. CGI is a hack at best.
>

CGI is de facto standard bridge between a web server and an
application. mod_lisp is a hack -- it is a C program grafted into one
particular implementation. FastCGI is slightly better than mod_lisp but
only exists because writing a fast cGI bridge requires C programming
anyway; unless the bridge is written in LISP.

CGI implemented in Common Lisp is an excellent solution: it eliminates
to patch a fix the web server, is written in good language, and runs
faster than a C program doing the same job. And then, when you need
state, you can connect to a persistent program from within the bridge.

David Tolpin
From: Marco Baringer
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <m21x7io1z2.fsf@soma.local>
·············@gmail.com" <············@gmail.com> writes:

> CGI is de facto standard bridge between a web server and an
> application. mod_lisp is a hack -- it is a C program grafted into one
> particular implementation. FastCGI is slightly better than mod_lisp but
> only exists because writing a fast cGI bridge requires C programming
> anyway; unless the bridge is written in LISP.

apache modules are de facto standards: mod_php, mod_perl, mod_gzip,
etc.

> CGI implemented in Common Lisp is an excellent solution: it eliminates
> to patch a fix the web server, is written in good language, and runs
> faster than a C program doing the same job. And then, when you need
> state, you can connect to a persistent program from within the bridge.

if you really really must use CGI and want it to be fast you could
write a mod_lisp.cgi program, this would be a trivial C program which
reads from **env and translates this into the mod_lisp wire protocol.

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen
From: ············@gmail.com
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1117885550.673599.118320@g44g2000cwa.googlegroups.com>
> > only exists because writing a fast cGI bridge requires C programming
> > anyway; unless the bridge is written in LISP.
>
> apache modules are de facto standards: mod_php, mod_perl, mod_gzip,
> etc.
>

Apache is just one particular web server implemented in C for posix
systems. There are many others supporting CGI. I don't want to
recompile Apache just to write a web application in Common Lisp.


> if you really really must use CGI and want it to be fast you could
> write a mod_lisp.cgi program, this would be a trivial C program which
> reads from **env and translates this into the mod_lisp wire protocol.
>

CGI in common lisp is faster than CGI in C: C cannot load memory image,
Lisp can.  And more powerful, of course, I can do with data whatever I
want before sending it to the stateful long-running application (if
needed). Besides, I don't want to program in C just to write a web
application in Common Lisp.

My CGIs in Common Lisp are fast and poweful, when they need, they
connect to a stateful framework. No C, Python, Perl, Java involved.
Works with any web server. What's wrong with that?

And yes, I wrote some half million lines in C in my life, rolled out a
few Python and Perl web applications, and am behind at least one big
commercial successful product in Java. But I don't see any reason to
add anything of it to the mix when I program my web applications in
lisp (which I do for 10 years now, in various lisp dialects, albeit
only for a few months in Common Lisp).

David
From: Brandon J. Van Every
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <Jzkoe.13778$M36.3632@newsread1.news.atl.earthlink.net>
············@gmail.com wrote:

>>>only exists because writing a fast cGI bridge requires C programming
>>>anyway; unless the bridge is written in LISP.
>>>      
>>>
>>apache modules are de facto standards: mod_php, mod_perl, mod_gzip,
>>etc.
>>
>>    
>>
>
>Apache is just one particular web server implemented in C for posix
>systems. There are many others supporting CGI. I don't want to
>recompile Apache just to write a web application in Common Lisp.
>  
>
Is Apache difficult to recompile?  Do recompilations consume untoward 
amounts of time in the development cycle?  If you just have to recompile 
it once and it's easy, I don't see what the problem is.  Maybe I have an 
idea that I'm going to be in charge of the webserver too, and you don't?

>>if you really really must use CGI and want it to be fast you could
>>write a mod_lisp.cgi program, this would be a trivial C program which
>>reads from **env and translates this into the mod_lisp wire protocol.
>>
>>    
>>
>
>CGI in common lisp is faster than CGI in C: C cannot load memory image,
>Lisp can.  And more powerful, of course, I can do with data whatever I
>want before sending it to the stateful long-running application (if
>needed). Besides, I don't want to program in C just to write a web
>application in Common Lisp.
>  
>
Is the C program not in fact trivial?

>My CGIs in Common Lisp are fast and poweful, when they need, they
>connect to a stateful framework. No C, Python, Perl, Java involved.
>Works with any web server. What's wrong with that?
>  
>
Is there a significant performance impact?  That's what people seem to 
be debating.  I must say, I find 2..4 seconds to generate a webpage 
downright piggish.  I'm not sure from the discussion what solves what.

-- 
Cheers,                     www.indiegamedesign.com
Brandon Van Every           Seattle, WA

"We live in a world of very bright people building
crappy software with total shit for tools and process."
                                - Ed McKenzie
From: ············@gmail.com
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1117906548.037473.89940@f14g2000cwb.googlegroups.com>
> >CGI in common lisp is faster than CGI in C: C cannot load memory image,
> >Lisp can.  And more powerful, of course, I can do with data whatever I
> >want before sending it to the stateful long-running application (if
> >needed). Besides, I don't want to program in C just to write a web
> >application in Common Lisp.
> >
> >
> Is the C program not in fact trivial?

It is trivial because it is in C. While when it is in Common Lisp, it
can do more.

>
> >My CGIs in Common Lisp are fast and poweful, when they need, they
> >connect to a stateful framework. No C, Python, Perl, Java involved.
> >Works with any web server. What's wrong with that?
> >
> >
> Is there a significant performance impact?  That's what people seem to
> be debating.  I must say, I find 2..4 seconds to generate a webpage
> downright piggish.  I'm not sure from the discussion what solves what.
>
>

A Common Lisp CGI launchs within 40 milliseconds  with CMUCL, and about
90 milliseconds with
CLISP. This is on my G4 powerbook, but in any case, where do 2..4
seconds come from?
From: Stefan Scholl
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1ktaenomha72v.dlg@parsec.no-spoon.de>
On 2005-06-04 18:23:05, Brandon J. Van Every wrote:
> ············@gmail.com wrote:
>>>apache modules are de facto standards: mod_php, mod_perl, mod_gzip,
>>>etc.
>>Apache is just one particular web server implemented in C for posix
>>systems. There are many others supporting CGI. I don't want to
>>recompile Apache just to write a web application in Common Lisp.
>>
> Is Apache difficult to recompile?  Do recompilations consume untoward 

You don't need to recompile Apache. Just compile the module and add
it to the config. Here's the line you have to enter when you want to
compile and add mod_lisp to your Apache:

	apxs -c -i -a mod_lisp.c
From: ············@gmail.com
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1117925218.048036.75020@o13g2000cwo.googlegroups.com>
> >>Apache is just one particular web server implemented in C for posix
> >>systems. There are many others supporting CGI. I don't want to
> >>recompile Apache just to write a web application in Common Lisp.
> >>
> > Is Apache difficult to recompile?  Do recompilations consume untoward
>
> You don't need to recompile Apache. Just compile the module and add
> it to the config. Here's the line you have to enter when you want to
> compile and add mod_lisp to your Apache:
>
> 	apxs -c -i -a mod_lisp.c

The key word is 'your'. Most apaches I deal with I not mine. I have my
public_html with +ExecCGI, and that's it. Some Apaches I deal with are
built without DSO support. Some servers I deal with do not even run
Apache.

mod_(perl|python|php|lisp) is a hack. With Python, Perl and PHP there
is an excuse for the hack: those programs are deadly slow to start.
With Lisp and memory images, when the startup time is hundredths of
seconds, there is no need for mod_lisp.

David
From: ············@gmail.com
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1117925464.390706.182230@z14g2000cwz.googlegroups.com>
> With Lisp and memory images, when the startup time is hundredths of
> seconds, 

a fraction of a second, I meant.
From: Edi Weitz
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <u4qce5bmy.fsf@agharta.de>
On 4 Jun 2005 04:45:50 -0700, ·············@gmail.com" <············@gmail.com> wrote:

> I don't want to recompile Apache just to write a web application in
> Common Lisp.

To add a module like mod_lisp you don't have to recompile Apache.

  <http://httpd.apache.org/docs/dso.html>

Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: ············@gmail.com
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1117906865.778671.157000@g47g2000cwa.googlegroups.com>
> To add a module like mod_lisp you don't have to recompile Apache.
>
>   <http://httpd.apache.org/docs/dso.html>
>


I knew someone would say it the moment I pressed the 'post' button. If
you have Apache properly installed with DSO compiled in, you don't have
to recompile it, but still need access to its configuration, and need
to restart it. It is not always the case. In particular, many of my
programs run on servers where I cannot add a dso module to Apache.

But I don't need them. Common Lisp based CGIs are fast and smart, they
are faster than C programs and smarter than Python and Perl scripts. I
just do with CGIs only most of the time, and when I need state (and I
rarely do), I let them connect to a long running applications. It is
functional programming, after all.

David
From: Stefan Scholl
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1x64uoo4auj1w.dlg@parsec.no-spoon.de>
On 2005-06-04 13:45:50, ············@gmail.com wrote:

> And yes, I wrote some half million lines in C in my life, rolled out a
> few Python and Perl web applications, and am behind at least one big
> commercial successful product in Java.

And yet you don't know that you don't have to recompile Apache just
to add a new module?
From: ············@gmail.com
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <1117924902.491626.84470@g47g2000cwa.googlegroups.com>
Stefan Scholl wrote:
> On 2005-06-04 13:45:50, ············@gmail.com wrote:
>
> > And yes, I wrote some half million lines in C in my life, rolled out a
> > few Python and Perl web applications, and am behind at least one big
> > commercial successful product in Java.
>
> And yet you don't know that you don't have to recompile Apache just
> to add a new module?

And I know that I don't have to recompile Apache just to add a new
module if Apache is built with DSO support and I can modify Apache's
installation. And if it is built without or is installed in a location
where I can't tweak its configuration file, I have to recompile a copy
of Apache for myself and install it on a non-privileged port to be able
to tweak its configuration files, add modules via apxs and such.

I am not the system administrator on every computer I run my CGI
scripts on.

David
From: Pascal Bourguignon
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <87wtpb46gb.fsf@thalassa.informatimago.com>
Emre Sevinc <·····@bilgi.edu.tr> writes:
> I am trying to write a simple web application in Common Lisp. The first
> problem was to interact with a database server. Thanks to Haldun
> Bayhantopcu's help, it is OK using CMUCL + CommonSQL.
>
> The second problem is that CommonSQL has support for only few Common
> Lisp interpreters and compilers. And those supported free ones does
> interestingly not support Shebang Characters for CGI execution. Thus I
> tried using modlisp for apache but that does not work as smooth as I
> expected.

With clisp, pg (Postgresql) works very nicely, and you can use clisp
as a CGI (faster load times than perl!)

Pg is a socket-level interface to the PostgreSQL object-relational Database.
http://www.cliki.net/pg


Note that you can as easily save your own image, and therefore load
your CGI at the same time you load the lisp image, with no need for a
#! script.

> Does anyone has an opinion to cope with these problems? Once I get a
> simple "Hello World" web page through (format t "Hello World~%"), then
> everything will be simpler.
>
> vst"
>
> Any suggestions?

If you're serrious about web programming, consider UCW.

UnCommon Web is a Common Lisp web application development framework. 
http://www.cliki.net/ucw



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Litter box not here.
You must have moved it again.
I'll poop in the sink. 
From: Alexander Schreiber
Subject: Re: Lisp and Web Programming
Date: 
Message-ID: <slrnda6j2e.d23.als@mordor.angband.thangorodrim.de>
Emre Sevinc <·····@bilgi.edu.tr> wrote:
>
> A friend asks:
>
> "Hi,
>
> I am trying to write a simple web application in Common Lisp. The first
> problem was to interact with a database server. Thanks to Haldun
> Bayhantopcu's help, it is OK using CMUCL + CommonSQL.
>
> The second problem is that CommonSQL has support for only few Common
> Lisp interpreters and compilers. And those supported free ones does
> interestingly not support Shebang Characters for CGI execution.

Funny, I was able to use CLISP, CMUCL and SBCL for CGI programming.
With CLISP you can directluse CLISP as in the interpreter for the #!
statement and for SBCL/CMUCL write a trivial wrapper script that 
execs the Lisp interpreter:

#!/bin/sh
exec sbcl --noinform   --end-runtime-options --noprogrammer --load cgi.lisp

Works like a charm, if a bit slow because SBCL always compiles before
execution. But for production use you'd be loading a precompiled image
anyway, right?

Regards,
      Alex.
-- 
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison