mod-guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mod-guile-devel] guile-handler


From: Dale P. Smith
Subject: Re: [Mod-guile-devel] guile-handler
Date: Mon, 29 Jul 2002 13:29:31 -0400

On Mon, 29 Jul 2002 18:55:04 +0200
address@hidden wrote:

> Hello list,
> 
> i toyed a bit more with the idea of a module-based
> 'guile-handler'. I hacked together a small testbed that
> has the basic functionallity (lacking most of the con-
> figuration options since this would mean changes to
> some of the strcuts). With this handler one can map 
> requests for certain URLs to functions in modules.
> Thanks to the almost not-exisiting documentation for
> guiles scm_* interface i'm not shure whether i'm doing
> things 'the right way' but at least it works. One design
> issue i came accross so far:
> 
> How should we handle output to the client?
> 
> - a transparent redirect (current-output-port will
>   point to an apache port that uses the apache api to
>   send data to the client). This is an aproach many
>   embeded script interpreters have:
>     (display (string-append "<h1>" (dynamic-stuff) "</h1>"))
>   will do 'the right thing'.

I've currently implemented this two ways.  The current-output-port is
just a string port that gets sent to the client when the request is
finished.  The second way is to use an apache port.  This sends the
output directly to the client with each write or display.

The problem with the second way, is that good error reports are
difficult to send to the client.

> - Have special functions that send data to the client:
> 
>   (define (handler request)
>     ...
>     (send-data request "<h1>" (dynamic-stuff) "</h1>")
>     ...)

What should be done with stdout? (or current-output-port in scheme terms).

> - Use 'goops' -- make 'display' a generic that can deal with
>   a request_rec as it's second parameter:
> 
>   (define (handler request)
>      ...
>      (display (string-append "<h1>" (dynamic-stuff) "</h1>") request) 
>      ...)
>  Of course, goop's C-api is pretty much undocumented ...

Actually, it doesn't really exist yet.  I wanted to use goops for
accessing the request_rec and other structures, but the lack of a C
interface pretty much made it impossible.

I think the "current-output-port goes to the client" is best.  Are there
any advantages to the other methods?

-Dale

-- 
Dale P. Smith
Senior Systems Consultant,      | Treasurer,
Altus Technologies Corporation  | Cleveland Linux Users Group
address@hidden            | http://cleveland.lug.net
440-746-9000 x339               |



reply via email to

[Prev in Thread] Current Thread [Next in Thread]