File: tcl-overview.html

package info (click to toggle)
aolserver4 4.5.1-12
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 11,768 kB
  • ctags: 14,788
  • sloc: ansic: 45,120; tcl: 5,532; sh: 1,021; makefile: 379; pascal: 219; php: 13
file content (172 lines) | stat: -rw-r--r-- 5,333 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<html>
<head>
<title>AOLserver</title>
</head>
<body>

<h1>AOLserver Tcl Overview</h1>

<p>
<small>
$Header: /cvsroot/aolserver/aolserver.com/docs/devel/tcl/tcl-overview.html,v 1.1 2002/03/07 19:15:35 kriston Exp $
</small>
<p>

<a href=#1>What is Tcl?</a>

<p>

<a href=#2>Why Use Tcl?</a>

<p>

<a href=#3>ADPs and Tcl Libraries</a>

<p>


<h2><a name=1>What is Tcl?</a></h2>

<p>

Tcl is a programming system developed by John Ousterhout at the
University of California, Berkeley. According to Dr. Ousterhout:

<p>

<blockquote>
<i>
Tcl is a simple scripting language for controlling and extending
applications; its name stands for "tool command language". Tcl
provides generic programming facilities, such as variables and loops
and procedures, that are useful in a variety of applications.
Furthermore, Tcl is embedable. Its interpreter is a library of C
procedures that can easily be incorporated into applications, and each
application can extend the core Tcl features with additional commands
for that application.
</i>
</blockquote>


<p>

AOLserver supports the Tcl v7.6 commands. When you write AOLserver
extensions in Tcl, you use the core functionality of Tcl as well as a
set of AOLserver-specific Tcl functions. For example, there is an
AOLserver Tcl function called ns_conn that allows your Tcl script to
obtain information about the current connection. In addition,
functions are available for returning results to Web clients,
accessing databases, and managing the permissions (access control)
system.

<p>

This book describes the two different methods for extending AOLserver
with Tcl, using AOLserver Dynamic Pages (Chapter 2) and Tcl libraries
(see Chapter 3), plus general information on using Tcl with either
method (see Chapter 4). It also provides a reference for AOLserver's
Tcl API (see Chapter 5).

<p>

 Recommended Reading

<p>

For more information on the Tcl language, we recommend the following
sources:
<p>
  * Practical Programming in Tcl and Tk, by Brent B. Welch (Prentice
 Hall PTR, 1995)
<p>
  * Tcl and the Tk Toolkit, by John K. Ousterhout (Addison-Wesley,
 1994)
<p>
  * For the complete manual pages for the Tcl v7.6 commands, visit the
 web site http://www.scriptics.com/man.
<p>
  * Philip Greenspun's web site,
 http://www-swiss.ai.mit.edu/wtr/dead-trees/, which includes
 chapters from his book, Database Backed Web Sites, The Thinking
 Person's Guide to Web Publishing, and numerous examples of
 AOLserver Tcl database applications.
<p>
  * The web site:
 http://www.yahoo.com/Computers_and_Internet/Programming_Languages/
 Tcl_Tk

<p>

<h2><a name=2>Why Use Tcl?</a></h2>

<p>

You can extend AOLserver using Tcl, C, or CGI. However, using Tcl has
the following advantages:
<p>
  * Creating new Tcl scripts is very easy. You can embed Tcl scripts
 directly into HTML pages using AOLserver Dynamic Pages (ADPs), or
 you can create .tcl files and register them to handle URLs or URL
 hierarchies.
<p>
  * Tcl's scripting language is easier to learn and use than compiled
 programming languages. It provides general programming
 capabilities, such as variables, loops, and procedures, but it
 doesn't require strong type definitions or compilation. Plus,
 AOLserver's Tcl interface provides a complete set of Tcl
 extensions specifically oriented towards web server applications,
 such as returning content to the client, accessing form data,
 accessing databases, and logging.
<p>
  * Many of the basic AOLserver services are implemented as Tcl
 scripts. In fact, most of the database operations such as handling
 database inserts, queries, and updates, are written as Tcl
 scripts. Not only has the Tcl interface greatly reduced the
 development time for the AOLserver engineering team, it also
 allows you to easily modify the basic database operations by
 simply editing the Tcl scripts that implement the functionality.
<p>
  * The Tcl and C interfaces typically provide better performance than
 CGI. However, if you have existing CGI programs, you may want to
 use AOLserver's CGI interfaces to take advantage of
 previously-existing code.

<p>

The C interface for AOLserver is described in the AOLserver C
Developer's Guide, and the CGI interface is desribed in the AOLserver
Administrator's Guide.

<p>



<h2><a name=3>ADPs and Tcl Libraries</a></h2>

<p>

There are two ways to extend AOLserver using Tcl, and each is
better-suited to different situations:
<p>
  * AOLserver Dynamic Pages (ADPs): ADPs allow you to embed Tcl
 scripts directly into HTML pages. The script(s) are interpreted
 dynamically when the page is accessed. ADPs are ideal in
 situations where you want to generate all or part of a specific
 page dynamically. You can re-use code by storing Tcl scripts in
 Tcl libraries and invoking them from within multiple ADPs. You can
 also include files and parse other ADPs from within your ADPs.

<p>

  * Tcl Libraries: The alternative to embedding Tcl scripts in HTML
 pages using ADPs, is to store Tcl scripts in Tcl libraries. You
 can define scripts that can be called from ADPs, schedule
 procedures to run at certain times, register scripts to handle
 specific URLs or URL hierarchies, register scripts to handle all
 URLs with a specific file extension, and register filters to be
 run in addition to a URL's registered procedure.

<p>

</body>
</html>