From: David Welton <davidw@master.debian.org> Subject: mod_dtcl 0.4.2 - server parsed tcl for apache Date: 1 Feb 1999 20:56:46 -0800 Hello, I have, as the version number would indicate, made several releases of mod_dtcl in the past, but I would like more people to use, test, and comment on it, so I am publicizing it more openly. I welcome all comments, suggestions, ideas and thoughs, and would appreciate it if they were directed to the mailing list. I am including the text version of mod_dtcl's readme: WHAT IS mod_dtcl ?: * mod_dtcl is a free/open source implementation of server parsed [1]Tcl, under [2]Apache, distributed under the terms of the GNU GPL. It allows you to tightly integrate html with Tcl, a widely used scripting language with many years of development invested in it. This is an ideal combination, allowing you to greatly extend what you could do with plain html. Because Tcl is such a widely used language, there is a large amount of documentation for it, both on the net and books. There are also many external Tcl modules that you can load into mod_dtcl, to create images, access databases, etc. Apache, is, of course, the world's most popular web server. If you aren't reading this from the web pages, they are available at [3]"http://comanche.com.dtu.dk/dave/. [4]Install mod_dtcl! EXAMPLES: * The [5]examples.ttml file has a few very limited examples of what is possible with mod_dtcl. You need to make it accessable to the web server in order to be able to view it. Put it in your public_html directory or something. Have a look at my rough [6]benchmarks - although they are unscientific, the results are interesting. COMMANDS: Special mod_dtcl commands * hputs ?-error? - like puts, but to the client instead of stdout. The error option permits you to send an 'error message' to the apache log file, at the NOTICE level. * hgetvars - get the environmental vars. This is in a seperate command so as not to make the server do this every time you load a .ttml file. ENVS and VARS are the two associative arrays loaded. ENVS contains environmental variables, VARS contains all the 'cgi' variables. Look in the examples.ttml file to see how these work. * include filename - include a flat file. Useful for including HTML files. SUPPORT: There is a mailing list at [7]mod_dtcl@lists.prosa.it. Mod_dtcl is currently alpha software (meaning that it is subject to change), however, due to the relative simplicity of the design, it is fairly stable, and performs well. If you have any questions or comments, please send them to the mailing list, or to me. TODO: * Decide whether to create a new interpreter for each page, or use a seperate namespace for each one. The namespace solution is faster, and allows things like global configs, however, it is possible to create global variables that are persistant within one apache process. The Tcl_Create method seems cleaner, but does not permit global config files, and might be slower. * Decide on standard opening and closing tokens - currently using <+ and +> for no particular reason. * Security review. * There ought to be a way to make it so things like while {1} doesn't go ape and make the process run away. I.e., create a limit on the maximum execution time. * Lots more commands.. like php, to make life easier. Some things will have to be done in the module itself, I think, like cookie things, because they deal with headers. Other things could probably be implemented in tcl, if the speed loss isn't too great. PHP would be a good place to look for examples. * Make file uploads work. Once again, PHP has some code which does this, but it looks like a hairy mime mess. It's a pity that Apache doesn't have a standard way of getting stuff out of headers, without doing most of the parsing yourself. * Configurations options: safe mode, ???. * Use flex as a lexer instead of my own, handwritten one? Not much of a point, I guess, but it might be informative/interesting/fun. * Long term: it would be neat to build something that could use any one of a variety of languages, like Perl, Python, Guile..whatever. * Long term: maybe have a seperate process running somewhere that all the different server processes could talk to, similiar to how java servlets work (ridruejo@esi.us.es). WHY: Why mod_dtcl when there are already so many other server parsed implementations? * Because it was fun to do:-) * Because Tcl is a common and relatively well known language. [8]PHP, while nice, is not really used much outside the web. It's easier, and more practical, to learn a more general language, that can be used outside of the web, for many other applications. Also, Tcl has had many more years than PHP to mature, and it has a large user base. * Because mod_perl is a big heavy chunk of Perl that seems like overkill for many things. I didn't really investigate it all that thoroughly though:-) Mod_dtcl aims to be more lightweight - it doesn't get involved in the server config files, for instance. If someone were interested, they could write a companion module "mod_tcl_config". Just an idea... INTERNALS: A brief description of how it works. For each page requested, a new tcl namespace is created within the global namespace. The module then reads through the page, aggregating plain HTML into big "hputs" statements, and anything between the delimiters ( <+ and +> ) as regular tcl. After this is done, the whole script is eval'ed and sent to the client. After it is eval'ed, the namespace that it was run in is destroyed, so as to destroy local variables. Read the code for more info:-) THANKS: I would like to thank Daniel Ridruejo for furnishing me with the web space, Rolf Ade, and the various people subscribed to the mod_dtcl mailing list for ideas, comments and suggestions. [9]Send me mail about mod_dtcl! mod_dtcl is Copyright [10]David Welton 1998 $Id: readme.html,v 1.4 1999/01/30 22:01:19 davidw Exp $ References 1. http://www.scriptics.com/ 2. http://www.apache.org/ 3. http://comanche.com.dtu.dk/dave/ 4. file://localhost/home/davidw/web/mod_dtcl/INSTALL.html 5. file://localhost/home/davidw/web/mod_dtcl/examples.ttml 6. file://localhost/home/davidw/web/mod_dtcl/benchmark.html 7. mailto:mod_dtcl@lists.prosa.it 8. http://www.php.net/ 9. mailto:davidw@debian.org 10. http://www.efn.org/~davidw Thankyou, -- David Welton http://www.efn.org/~davidw www.prosa.it - Debian GNU/Linux - www.debian.org [[Send Tcl/Tk announcements to tcl-announce@mitchell.org Send administrivia to tcl-announce-request@mitchell.org Announcements archived at http://www.findmail.com/list/tcl_announce/ The primary Tcl/Tk archive is ftp://ftp.neosoft.com/pub/tcl/ ]]