X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=doc%2Ffastcgi-prog-guide%2Fch4tcl.htm;h=9a5f652d40472153e7aa0404e24ef54535ff63cd;hb=fdee298fbf8f873409f8552429a75017f70804bf;hp=434993d6d84c8e56b5dacf92b60d3b72604a6500;hpb=6791223eaff3cd3ff05cc1da59b5ed8fde3a5037;p=catagits%2Ffcgi2.git diff --git a/doc/fastcgi-prog-guide/ch4tcl.htm b/doc/fastcgi-prog-guide/ch4tcl.htm index 434993d..9a5f652 100755 --- a/doc/fastcgi-prog-guide/ch4tcl.htm +++ b/doc/fastcgi-prog-guide/ch4tcl.htm @@ -1,45 +1,104 @@ -
- -The FastCGI-savvy binaries are extensions of standard Tcl, and are intended to replace your existing Tcl installation. There is no need to maintain two versions of Tcl: the version that we supply will work fine when invoked from a shell or a CGI program. There are also directions in the developer's kit for how to make your own FastCGI-savvy Tcl, if you need a version for some platform that we don't supply.
- -In many cases, you can convert a Tcl script from CGI to FastCGI by adding a few lines of code to an existing script. For more complex scripts, you may also need to rearrange some existing code.
-
- Getting Started
-
-The first line of any Tcl script typically specifies the pathname of the Tcl interpreter itself. You must specify the pathname of a FastCGI-savvy Tcl.
- -Then, you have to divide FastCGI scripts into the following two sections:
-
-
-while {[FCGI_Accept] >= 0 } { - - -# body of response loop - - -} - --The
FCGI_Accept
call returns 0 whenever a client requests the FastCGI script. Otherwise, the FCGI_Accept
call returns -1.
-
- Example: TinyFastCGI
-
-Here is a simple example of a FastCGI application written in Tcl:
-
+ + + ++ FastCGI Programmer's Guide - Chapter 4, Developing FastCGI Applications in Tcl + + + + + [Top] [Prev] [Next] [Bottom] +
+
+ +++ ++ 4 Developing FastCGI
+
+ Applications in Tcl ++ This chapter explains how to code FastCGI applications in Tcl. Prior to creating a FastCGI application, you + must have a FastCGI-savvy version of the Tcl interpreter. Open Market develops Tcl binaries for popular + platforms and makes them available with our developer's kit. +
++ The FastCGI-savvy binaries are extensions of standard Tcl, and are intended to replace + your existing Tcl installation. There is no need to maintain two versions of Tcl: the version that we supply + will work fine when invoked from a shell or a CGI program. There are also directions in the developer's + kit for how to make your own FastCGI-savvy Tcl, if you need a version for some platform that we don't + supply. +
++ In many cases, you can convert a Tcl script from CGI to FastCGI by adding a few lines of + code to an existing script. For more complex scripts, you may also need to rearrange some existing code. +
+
+
++ Getting Started +
+ ++ The first line of any Tcl script typically specifies the pathname of the Tcl interpreter itself. You must + specify the pathname of a FastCGI-savvy Tcl. +
++ Then, you have to divide FastCGI scripts into the following two sections: +
+
+
+
+ A response loop typically has the following format: +
++while {[FCGI_Accept] >= 0 } { + +# body of response loop + +} + ++ +
+ The FCGI_Accept
call returns 0 whenever a client requests the FastCGI script. Otherwise, the
+ FCGI_Accept
call returns -1.
+
+ Here is a simple example of a FastCGI application written in Tcl: +
++ #!fcgi-savvy-tcl set count 0 @@ -47,27 +106,26 @@ set count 0 # Response Loop while {[FCGI_Accept] >= 0 } { incr count - puts -nonewline "Content-type: text/html\r\n\r\n" - puts "<title>FastCGI Hello! (Tcl)</title>" - puts "<h1>FastCGI Hello! (Tcl)</h1>" - puts "Request number $count running on host <i>$env(SERVER_NAME)</i>" + puts -nonewline "Content-type: text/html\r\n\r\n" + puts "<title>FastCGI Hello! (Tcl)</title>" + puts "<h1>FastCGI Hello! (Tcl)</h1>" + puts "Request number $count running on host <i>$env(SERVER_NAME)</i>" } --
- -
+
+