This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: Guile as modperl
- To: guile@cygnus.com
- Subject: Re: Guile as modperl
- From: forcer <forcer@mindless.com>
- Date: Wed, 2 Jun 1999 14:50:15 +0200
- References: <3754ABEA.6F501D21@bigfoot.com>
Chris Bitmead <chris.bitmead@bigfoot.com> writes:
> Has much work been done to make guile a kind of modperl?
> e.g.
> Has anyone made guile into an apache module?
It's on the top of my to-do list. I'd love to have mod_guile.
Also, i'm considering to have a feature similar to Embedperl/PHP
- inline-code in HTML.
Everything around <?scm ... ?> would be translated into
``(display "...'', <?scm to ``")'', ?> to ``(display "'',
and EOF to ``")''
This simple transformation would make the whole stuff very simple
and elegant. As an example:
Checking for browser ...
<?scm (if (string-match "lynx" (user-agent)) ?>
You use "lynx"
<?scm?>
You use some inferior browser
<?scm ) ?>
<br>
Would be translated into
(display "Checking for browser ...")
(if (string-match "lynx" (user-agent))
(display " You use \"lynx\"")
(display " You use some inferior browser"))
(display "<br>")
(well ok, probably not that nicely formatted, but formatting
isn't *that* important here :])
I ordered "Writing Apache modules in Perl and C" which should
arrive on friday so i can start working then.
Things i'm not sure about for now:
- I want to make apache modules be writeable in guile, like
mod_perl. Should the above be implemented rather in guile, then?
(sounds like a good idea)
- How to make the environment secure. In perl (or Tcl, or Python)
i'd just create a new instances of the interpreter. Guile
doesn't have things like instances. I guess i'll have to do
something with the environment there, but i'm not sure about it
yet.
- Wether to use a C parser in the mod_guile.c or a different
reader for guile for those pages
I wanted to come to this list and ask for people who have
experience with Apache modules, and a better understanding of
Guile's internals than i do, but since you asked, i guess i can
come now :) Any more suggestions, ideas, etc.?
And to the other points:
PHP sounds like a good platform to look at. It has all the stuff
to be utterly replaced by guile.
- Simple syntax&semantics: PHP reader for guile shouldn't be
a big problem
- Crappy language: experienced people would love to use a more
powerful language without losing all the functions PHP
gives them
- Nice function collection: PHP has alot of nice functions
(mostly library wrappers), which we could add to Guile's
module list.
(I've done a GD module, though it's not integrated into
Guile's module system (yet) - i'm waiting for the new
version. See http://forcix.cx/code/guile-gd.tar.gz)
People wanting to add to guile but not knowing what to do
can take a look at the online-manual of PHP (www.php.net)
and see what other libraries PHP uses and which are not
yet wrapped by guile
Then again, for the main mod_guile package (the one to make
apache modules writeable in guile), i'll take a close look at
mod_perl. Wrapping Apache's data structures in guile smobs or
vectors can't be too difficult from what i've seen so far.
(define (add-version param d vers)
(ap-add-version-component vers))
(define version-cmds
(("AddVersion" add-version 0 RSRC_CONF TAKE1 "Server version to add")))
(module 0 0 0 0 0 version-cmds 0 0 0 0 0 0 0 0)
... would be nice to write modules like that :]
Ok, to repeat my request above:
If any of you have ideas, comments, critics, etc. please let me
know.
-forcer
--
((email . "forcer@mindless.com") (www . "http://forcix.cx/")
(irc . "forcer@#StarWars (IRCnet)") (gpg . "/other/forcer.gpg"))