Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

An example of a more complex script is Tamarind: a CGI application in TXR which lets users log in with their IMAP/SASL credentials and edit their personal list of randomly generated throwaway e-mail aliases.

http://www.kylheku.com/cgit/tamarind/tree

This is a CGI script that runs under Apache. It doesn't use any web framework; everything is there in the code: parsing URL parameters and form data, handling sessions and authentication, etc.

In early versions, I scanned the /etc/passwd file and authenticated users by doing raw crypt calls on the passwords. Then I upgraded to SASL authentication: sending tokens to "saslauthd" over Unix sockets. This is in

http://www.kylheku.com/cgit/tamarind/tree/auth.txr

Then I added IMAP. That was an example of incremental development. I tested the IMAP code in isolation and then just planted it into auth.txr.

I was surprised because I was sure that would be done in Lisp; but the pattern language easily implements the IMAP conversation needed to authenticate.

I expected most of Tamarind to be Lisp; I'm surprised how much of it in general ended up TXR via a path of least resistance.



I actually tried running TXR from a Python web service so that I could work with it via a web interface, but running it with subprocess felt all wrong. It didn't occur to me to do it as CGI as it would have seemed far too ambitious for a beginner, but that looks surprisingly straightforward.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: