guile-user
[Top][All Lists]
Advanced

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

Re: Web development


From: Alejandro Forero Cuervo
Subject: Re: Web development
Date: Sun, 11 Nov 2001 22:04:03 -0500
User-agent: Mutt/1.2.5i

    There are many attepmpts to use guile in web already. But all of
    then are in childhood and add nothing to basic functionaity (there
    is no cockies handling for ex.)

    That we all are _really_ needing is power transaction system.
    Which will keep state of user connection and their "variables".

I don't know if you have looked at HB <http://bachue.com/hb>.

It has its own language to create dynamic (server-side) web
applications and lets you embbed Scheme code inside of it (you could
almost forget about HB's language, just add one line at the beginning
of your files and one at the end... or if this is too much of a
problem, we could add some handler so that files ending in .scm are
recognized as Guile files and parsed by it).

For instance, you can currently do things such as:

    :out (guile.exec) main

    ; Here goes a lot of code that Guile executes once for every
    ; HTTP request.

    (define (colorize text)
      (string-append "<b><font color='#ffffff'>" text "</font></b>"))

    (define (display-p text)
      (display "<p>") (display text) (display "</p>"))

    (display "<html><body>")
    (display-p (colorize "Hello World"))
    (display "</html></body>")

    :

I recently received some mail praising HB as a tool to make web
development in Guile, you could read it at
    <http://groups.yahoo.com/group/hb-usr/message/235>.

There is more information on how to use Guile for web development
through HB at
    <http://bachue.com/hb/hb.cgi/guile>.


HB already provides functionality to do many of the tipically useful
web-related things, such as (just making a short list out of the top
of my head):

- Support HTTP Persistant cookies
- Support file uploads (<form enctype="multipart/formdata">)
- Has a simple templating system (<+hb.clean>)
- Has a lot of "modules" that do useful things such as keep message
  boards (forums, guestbooks, whatever) or polls (with code from
  Pollera <http://bachue.com/alejo/pollera.html>) or perform user
  authentication (against multiple backends)
- Connect to databases (currently PostgreSQL and MySQL)

I haven't tested HB-Guile bindings in real life but I think they
should work nicely.  It should be very easy to make it possible to use
all of HB's functionality from Scheme code embbeded inside HB files.

There are different modes to run HB as of this writing:

- It can run strictly under CGI.

- It can run as a daemon that listens on a TCP/IP socket, with a
  lightweight CGI process forwarding the requests to the daemon.

- It can run as a daemon that receives the requests from the Apache
  mod_hb.  However, this is still broken in some small regards
  (cookies and file uploading are not working in the last released
  version).

- It can be run directly from the command line/scripts/Makefiles (this
  is useful for people that want their site to be a lot of static HTML
  files that are generated dynamically using HB's templating system).
  It's also possible to pass requests to an HB daemon from the command
  line/scripts/Makefiles.

- HB can receive requests directly from the browsers.  The protocol
  the HB daemon uses is a subset of HTTP.  It seems to work without
  problems with most browsers (have tried it with Mozilla, Netscape 4,
  wget, w3m, MSIE and Opera).  However, there are still some features
  of HTTP that are not supported (most HTTP headers get currently
  ignored... for instance, there is no Keep-Alive) so it's best to use
  Apache between HB and the browser.

When run as a daemon, HB can be setup to use multiple POSIX threads or
not.  If they are used, it can handle multiple requests concurrently.
However, Guile is not up for POSIX threads so people wanting to use
HB-Guile bindings are forced to build HB without threads.

HB surely does need testing for the Guile integration (as well as for
the Perl integration).  I am an active developer of HB and I would
like to make whatever I can so HB becomes a great platform to make web
development using Scheme.  In order to do so, I would greatly
appreciate it if interested people could begin to test it and send me
suggestions on how to improve it.

Thank you.

Alejo.
http://bachue.com/alejo

--
The mere formulation of a problem is far more essential than its solution.
      -- Albert Einstein.

$0='!/sfldbi!yjoV0msfQ!sfiupob!utvK'x44;print map{("\e[7m \e[0m",chr ord
(chop$0)-1)[$_].("\n")[++$i%77]}split//,unpack'B*',pack'H*',($F='F'x19).
"F0F3E0607879CC1E0F0F339F3FF399C666733333CCF87F99E6133999999E67CFFCCF3".
"219CC1CCC033E7E660198CCE4E66798303873CCE60F3387$F"#Don't you love Perl?

Attachment: pgp6NXNDqlmIZ.pgp
Description: PGP signature


reply via email to

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