File: rivet.en.html

package info (click to toggle)
rivet 0.5.0-3.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,676 kB
  • ctags: 1,345
  • sloc: sh: 8,394; xml: 6,622; ansic: 4,367; tcl: 2,813; makefile: 101; lisp: 78; sql: 25
file content (1674 lines) | stat: -rw-r--r-- 195,734 bytes parent folder | download | duplicates (2)
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Apache Rivet</title><link rel="stylesheet" href="rivet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id4744838"></a>Apache Rivet</h1></div><div><div class="author"><h3 class="author"><span class="firstname">The Rivet Team</span></h3><div class="affiliation"><span class="orgname">The Apache Software Foundation<br></span><div class="address"><p><br>
	<tt class="email">&lt;<a href="mailto:rivet-dev@tcl.apache.org">rivet-dev@tcl.apache.org</a>&gt;</tt><br>
	</p></div></div></div></div><div><p class="copyright">Copyright  2002, 2003, 2004 Apache Software Foundation</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id4695530">Introduction to Apache Rivet</a></span></dt><dt><span class="section"><a href="#installation">Apache Rivet Installation</a></span></dt><dt><span class="section"><a href="#directives">Rivet Apache Directives</a></span></dt><dt><span class="section"><a href="#commands">Rivet Tcl Commands and Variables</a></span></dt><dt><span class="section"><a href="#examples">Examples and Usage</a></span></dt><dt><span class="section"><a href="#tcl_packages">Rivet Tcl Packages</a></span></dt><dt><span class="section"><a href="#dio">DIO - Database Interface Objects</a></span></dt><dt><span class="section"><a href="#diodisplay">DIODisplay - Database Interface Objects Display Class</a></span></dt><dt><span class="section"><a href="#session_package">Session Package</a></span></dt><dd><dl><dt><span class="section"><a href="#id4753522">Introduction</a></span></dt><dt><span class="section"><a href="#id4753560">Requirements</a></span></dt><dt><span class="section"><a href="#id4753573">Preparing To Use It</a></span></dt><dt><span class="section"><a href="#id4753623">Example Usage</a></span></dt><dt><span class="section"><a href="#id4753689">Using Sessions From Your Code</a></span></dt><dt><span class="section"><a href="#id4753897">Session Configuration Options</a></span></dt><dt><span class="section"><a href="#id4754151">Session Methods</a></span></dt><dt><span class="section"><a href="#id4754390">Getting Additional Randomness From The Entropy File</a></span></dt></dl></dd><dt><span class="section"><a href="#help">Resources - How to Get Help</a></span></dt><dd><dl><dt><span class="section"><a href="#id4754425">Mailing Lists</a></span></dt><dt><span class="section"><a href="#id4754470">Newsgroup</a></span></dt><dt><span class="section"><a href="#websites">Web Sites</a></span></dt><dt><span class="section"><a href="#id4754556">Bug Tracking System</a></span></dt><dt><span class="section"><a href="#id4754574">IRC</a></span></dt><dt><span class="section"><a href="#id4754586">Editing Rivet Template Files</a></span></dt></dl></dd><dt><span class="section"><a href="#internals">Rivet Internals</a></span></dt><dd><dl><dt><span class="section"><a href="#id4754656">Initialization</a></span></dt><dt><span class="section"><a href="#id4754694">RivetChan</a></span></dt><dt><span class="section"><a href="#id4754721">The <span style="font-family:monospace"><span><b class="command">global</b></span></span> Command</a></span></dt><dt><span class="section"><a href="#id4754773">Page Parsing, Execution and Caching</a></span></dt><dt><span class="section"><a href="#id4754823">Debugging Rivet and Apache</a></span></dt></dl></dd><dt><span class="section"><a href="#upgrading">Upgrading from mod_dtcl or NeoWebScript</a></span></dt><dd><dl><dt><span class="section"><a href="#id4754995">mod_dtcl</a></span></dt><dt><span class="section"><a href="#id4755008">NeoWebScript</a></span></dt></dl></dd></dl></div><p style="width:90%">
    This document is also available in the following languages: <a href="index.it.html" target="_top">Italian</a>, <a href="index.ru.html" target="_top">Russian</a>
  </p><p style="width:90%">
    Document revision: $Revision: 1.52 $, last modified $Date: 2005/03/12 14:26:20 $ by $Author: davidw $.
  </p><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="id4695530"></a>Introduction to Apache Rivet</h2></div></div></div><p style="width:90%">
      Apache Rivet is a system for creating dynamic web content via a
      programming language integrated with Apache Web Server.  It is
      designed to be fast, powerful and extensible, consume few system
      resources, be easy to learn, and to provide the user with a
      platform that can also be used for other programming tasks
      outside the web (GUI's, system administration tasks, text
      processing, database manipulation, XML, and so on).  In order to
      meet these goals, we have chosen the Tcl programming language to
      combine with the Apache Web Server.
    </p><p style="width:90%">
      In this manual, we aim to help get you started, and then
      writing productive code as quickly as possible, as well as
      giving you ideas on how to best take advantage of Rivet's
      architecture to create different styles of web site.
    </p><p style="width:90%">
      This documentation is a work in progress, and, like everything
      else about Apache Rivet, it is Free Software.  If you see
      something that needs improving, and have ideas or suggestions,
      don't hesitate to let us know.  If you want to contribute
      directly, better yet!
    </p></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="installation"></a>Apache Rivet Installation</h2></div></div></div><div class="procedure"><ol type="1"><li><p class="title"><b>Check Dependencies</b></p><p style="width:90%">
	  To install Rivet, you will need Tcl 8.2 or greater and
	  Apache 1.3.xx.  It is known to run on Linux, FreeBSD,
	  OpenBSD, and Solaris and HPUX.  Windows NT is also possible
	  - please see the directions in the distribution.
	</p></li><li><p class="title"><b>Get Rivet</b></p><p style="width:90%">
	  Download the sources at <a href="http://tcl.apache.org/rivet/download" target="_top">http://tcl.apache.org/rivet/download</a>.  Currently
	  the only way to obtain Rivet.  In the future, we hope to
	  have a FreeBSD port, Debian package, RPM's, and windows
	  binaries.
	</p></li><li><p class="title"><b>Install Tcl</b></p><p style="width:90%">
	  If you don't have Tcl already, you need it!  If you already
	  have it, you should just be able to use your system Tcl as
	  long as it is recent.  You can tell Rivet where Tcl is via
	  the -with-tclconfig option to
	  <span style="font-family:monospace"><span><b class="command">configure.tcl</b></span></span> (see below).</p></li><li><p class="title"><b>Get and Install Apache Sources</b></p><p style="width:90%">
          Rivet needs some Apache include (.h) files in order to
	  build.  The easiest way to get them is to download the
	  source code of the Apache web server, although some systems
	  (Debian GNU/Linux for example) make it possible to install
	  only the headers and other development files.  If you intend
	  to build Rivet statically (compiled into the Apache web
	  server instead of loaded dynamically), you definitely need
	  the sources.  We recommend that you build Rivet as a
	  loadable shared library, for maximum flexibility, meaning
	  that you also build Apache to be able to load modules.
	  Other than that, the default Apache install is fine.  We
	  will tell Rivet where it is located via the
	  -with-apxs option to
	  <span style="font-family:monospace"><span><b class="command">configure.tcl</b></span></span> (see below).
	</p><p style="width:90%">
          The source code for the Apache web server may be found by
          following the links here: <a href="http://httpd.apache.org/" target="_top">http://httpd.apache.org/</a>.
	</p></li><li><p class="title"><b>Uncompress Sources</b></p><p style="width:90%">
	  We will assume that you have Apache installed at this point.
	  You must uncompress the Rivet sources in the directory where you
	  wish to compile them.

	  </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">gunzip tcl-rivet-X.X.X.tar.gz
tar -xvf tcl-rivet-X.X.X.tar.gz</pre><p style="width:90%">

	</p></li><li><p class="title"><b>Building Rivet</b></p><p style="width:90%">
	  On Linux or Unix systems, Rivet uses the standard
	  ./configure ; make ; make install technique.
	</p><ol type="a"><li><p class="title"><b>Run ./configure.tcl</b></p><p style="width:90%">
	      This is similar to the <tt class="filename">configure</tt>
	      script included with many systems.  It's written in Tcl
	      though, for increased speed and clarity.  It takes
	      several arguments:
	    </p><div class="variablelist"><dl><dt><span class="term">-help</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Prints usage information.</div></div></dd><dt><span class="term">-enable-symbols</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Compiles Rivet with debugging symbols.</div></div></dd><dt><span class="term">-prefix <i class="replaceable"><tt>directory</tt></i></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		    Install Rivet Tcl packages to
		    <i class="replaceable"><tt>directory</tt></i>.
		  </div></div></dd><dt><span class="term">-with-apxs <i class="replaceable"><tt>file</tt></i></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Use <i class="replaceable"><tt>file</tt></i> as apxs binary to
		  gather information about the local Apache installation.</div></div></dd><dt><span class="term">-with-tclconfig <i class="replaceable"><tt>path/to/tcl/tclConfig.sh</tt></i></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		    Specify <i class="replaceable"><tt>file</tt></i> as the
		    tclConfig.sh of the Tcl installation that you want
		    to use with Rivet.
		  </div></div></dd></dl></div><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">cd src/
./configure.tcl
Configuring
.........done.</pre></li><li><p class="title"><b>Run make.tcl</b></p><p style="width:90%">
	      At this point, you are ready to run the build
	      system:
	    </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">./make.tcl <i class="replaceable"><tt>option</tt></i></pre><p style="width:90%">where <i class="replaceable"><tt>option</tt></i> can be
	      either shared or
	      static.
	    </p></li><li><p class="title"><b>Install</b></p><p style="width:90%">
	      Now, you are ready to run the <span style="font-family:monospace"><span><b class="command">./make.tcl
		install</b></span></span> command to install the resulting
	      files.  This should copy the shared object (like
	      <tt class="filename">mod_rivet.so</tt>, if one was
	      successfully created, into Apache's
	      <tt class="filename">libexec</tt> directory, as well as
	      install some support scripts and various code.
	    </p></li></ol></li><li><p class="title"><b>Apache Configuration Files</b></p><p style="width:90%">
	  Rivet is relatively easy to configure - we start off by
	  adding the module itself:
	</p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">LoadModule rivet_module	<i class="replaceable"><tt>/usr/lib/apache/1.3/mod_rivet.so</tt></i></pre><p style="width:90%">
	  This tells Apache to load the Rivet shared object, wherever
	  it happens to reside on your file system.  Now we have to
	  tell Apache what kind of files are "Rivet" files and how to
	  process them:
	</p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">AddType application/x-httpd-rivet .rvt
AddType application/x-rivet-tcl .tcl</pre><p style="width:90%">
	  These tell Apache to process files with the
	  <tt class="filename">.rvt</tt> and <tt class="filename">.tcl</tt>
	  extensions as Rivet files.
	</p><p style="width:90%">
	  For other directives that Rivet provides for Apache
	  configuration, please see <a href="#directives" title="Rivet Apache Directives">the section called &#8220;Rivet Apache Directives&#8221;</a>.
	</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="directives"></a>Rivet Apache Directives</h2></div></div></div><p style="width:90%">
      These directives are used within the Apache httpd server
      configuration files to modify Apache Rivet's behavior.  Their
      precedence is as follows: <span style="font-family:monospace"><span><b class="command">RivetDirConf</b></span></span>,
      <span style="font-family:monospace"><span><b class="command">RivetUserConf</b></span></span>,
      <span style="font-family:monospace"><span><b class="command">RivetServerConf</b></span></span>, meaning that DirConf will
      override UserConf, which will in turn override ServerConf.
    </p><div class="variablelist"><dl><dt><span class="term">
	  <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">RivetServerConf</span>  (<span style="font-family:monospace; font-weight: bold;">CacheSize</span> | <span style="font-family:monospace; font-weight: bold;">GlobalInitScript</span> | <span style="font-family:monospace; font-weight: bold;">ChildInitScript</span> | <span style="font-family:monospace; font-weight: bold;">ChildExitScript</span> | <span style="font-family:monospace; font-weight: bold;">BeforeScript</span> | <span style="font-family:monospace; font-weight: bold;">AfterScript</span> | <span style="font-family:monospace; font-weight: bold;">ErrorScript</span> | <span style="font-family:monospace; font-weight: bold;">UploadDirectory</span> | <span style="font-family:monospace; font-weight: bold;">UploadMaxSize</span> | <span style="font-family:monospace; font-weight: bold;">UploadFilesToVar</span> | <span style="font-family:monospace; font-weight: bold;">SeperateVirtualInterps</span>)</div></div>
	</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex"><span style="font-family:monospace"><span><b class="command">RivetServerConf</b></span></span> specifies a global
	    option that is valid for the whole server.  If you have a
	    virtual host, in some cases, the option specified in the
	    virtualhost takes precedence over the 'global' version.
	  </div><div class="variablelist"><dl><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">CacheSize</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>size</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Sets the size of the internal page cache, where
		  <i class="replaceable"><tt>size</tt></i> is
		  the number of byte-compiled pages to be cached for
		  future use.  Default is
		  <span style="font-family:monospace"><span><b class="command">MaxRequestsPerChild</b></span></span> / 5, or 50,
		  if <span style="font-family:monospace"><span><b class="command">MaxRequestsPerChild</b></span></span> is 0.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This option is completely global, even when using
		  separate, per-virtual host interpreters.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">GlobalInitScript</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>script</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Tcl script that is run when each interpreter is
		  initialized. <i class="replaceable"><tt>script</tt></i>
		  is an actual Tcl script, so to run a file, you would
		  do:

		  <pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">RivetServerConf GlobalInitScript "source /var/www/foobar.tcl"</pre>
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This option is ignored in virtual hosts.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">ChildInitScript</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>script</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Script to be evaluated when each Apache child
		  process is initialized.  This is the recommended
		  place to load modules, create global variables, open
		  connections to other facilities (such as databases)
		  and so on.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  In virtual hosts, this script is run in addition to
		  any global childinitscript.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">ChildExitScript</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>script</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Script to be evaluated when each Apache child
		  process exits.  This is the logical place to clean
		  up resources created in
		  ChildInitScript, if necessary.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  In virtual hosts, this script is run in addition to
		  any global childexitscript.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">BeforeScript</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>script</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Script to be evaluated before each server parsed
		  (.rvt) page.  This can be used to create a standard
		  header, for instance.  It could also be used to load
		  code that you need for every page, if you don't want
		  to put it in a GlobalInitScript
		  ChildInitScript when you are first
		  developing a web site.
		  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td colspan="2" align="left" valign="top">
		    This code is evaluated at the global level, not
		    inside the request namespace where pages are
		    evaluated.
		  </td></tr></table></div>
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  In virtual hosts, this option takes precedence over
		  the global setting.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">AfterScript</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>script</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Script to be called after each server parsed (.rvt) page.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  In virtual hosts, this option takes precedence over
		  the global setting.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">ErrorScript</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>script</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  When Rivet encounters an error in a script, it
		  constructs an HTML page with some information about
		  the error, and the script that was being
		  evaluated. If an ErrorScript is
		  specified, it is possible to create custom error
		  pages.  This may be useful if you want to make sure
		  that users never view your source code.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  In virtual hosts, this option takes precedence over
		  the global setting.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">UploadDirectory</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>directory</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Directory to place uploaded files.</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  In virtual hosts, this option takes precedence over
		  the global setting.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">UploadMaxSize</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>size</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Maximum size for uploaded files.</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  In virtual hosts, this option takes precedence over
		  the global setting.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">UploadFilesToVar</span>  (<span style="font-family:monospace; font-weight: bold;">yes</span> | <span style="font-family:monospace; font-weight: bold;">no</span>)</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  This option controls whether it is possible to
		  upload files to a Tcl variable.  If you have a size
		  limit, and don't have to deal with large files, this
		  might be more convenient than sending the data to a
		  file on disk.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">SeperateVirtualInterps</span>  (<span style="font-family:monospace; font-weight: bold;">yes</span> | <span style="font-family:monospace; font-weight: bold;">no</span>)</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  If on, Rivet will create a separate Tcl interpreter
		  for each Apache virtual host.  This is useful in an
		  ISP type situation where it is desirable to separate
		  clients into separate interpreters, so that they
		  don't accidentally interfere with one another.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">This option is, by nature, only available at the
		global level.</div></div></dd></dl></div></div></dd><dt><span class="term">
	  <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">RivetDirConf</span>  (<span style="font-family:monospace; font-weight: bold;">BeforeScript</span> | <span style="font-family:monospace; font-weight: bold;">AfterScript</span> | <span style="font-family:monospace; font-weight: bold;">ErrorScript</span> | <span style="font-family:monospace; font-weight: bold;">UploadDirectory</span>)</div></div>
	</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
	    These options are the same as for
	    <span style="font-family:monospace"><span><b class="command">RivetServerConf</b></span></span>, except that they are
	    only valid for the directory where they are specified, and
	    its subdirectories.  It may be specified in
	    <span style="font-family:monospace"><span><b class="command">Directory</b></span></span> sections.
	  </div></div></dd><dt><span class="term">
	  <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">RivetUserConf</span>  (<span style="font-family:monospace; font-weight: bold;">BeforeScript</span> | <span style="font-family:monospace; font-weight: bold;">AfterScript</span> | <span style="font-family:monospace; font-weight: bold;">ErrorScript</span> | <span style="font-family:monospace; font-weight: bold;">UploadDirectory</span>)</div></div>
	</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
	    These options are the same as for
	    <span style="font-family:monospace"><span><b class="command">RivetServerConf</b></span></span>, except that they are
	    only valid for the directory where they are specified, and
	    its subdirectories.
	  </div></div></dd></dl></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="commands"></a>Rivet Tcl Commands and Variables</h2></div></div></div><div class="toc"><dl><dt><a href="#id4745549">var</a> - get the value of a form variable.</dt><dt><a href="#id4746026">upload</a> - handle a file uploaded by a client.</dt><dt><a href="#id4746450">load_response</a> - load form variables into an array.</dt><dt><a href="#id4746495">load_headers</a> - get client request's headers.</dt><dt><a href="#id4746549">load_cookies</a> - get any cookie variables sent by the client.</dt><dt><a href="#id4746601">load_env</a> - get the request's environment variables.</dt><dt><a href="#id4746667">env</a> - Loads a single
	"environmental variable" into a Tcl variable.</dt><dt><a href="#id4746717">include</a> - includes a file into the output stream without modification.</dt><dt><a href="#id4746771">parse</a> - parses a Rivet template file.</dt><dt><a href="#id4746830">headers</a> - set and parse HTTP headers.</dt><dt><a href="#id4747164">makeurl</a> - construct url's based on hostname, port.</dt><dt><a href="#id4747227">cookie</a> - get and set cookies.</dt><dt><a href="#id4747391">clock_to_rfc850_gmt</a> - create a rfc850 time from [clock seconds].</dt><dt><a href="#id4747441">html</a> - construct html tagged text.</dt><dt><a href="#id4747511">incr0</a> - increment a variable or set it to 1 if nonexistant.</dt><dt><a href="#id4747579">parray</a> - Tcl's parray with html formatting.</dt><dt><a href="#id4747650">abort_page</a> - Stops outputing data to web page, similar in
	  purpose to PHP's die command.</dt><dt><a href="#id4747705">no_body</a> - Prevents Rivet from sending any content.</dt><dt><a href="#id4747746">escape_string</a> - convert a string into escaped characters.</dt><dt><a href="#id4747800">escape_sgml_chars</a> - escape special SGML characters in a string.</dt><dt><a href="#id4747852">escape_shell_command</a> - escape shell metacharacters in a string.</dt><dt><a href="#id4747908">unescape_string</a> - unescape escaped characters in a string.</dt></dl></div><div class="refentry" lang="en"><a name="id4745549"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">var, var_qs, var_post &#8212; get the value of a form variable.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">
	    var
	  </span>  (<span style="font-family:monospace; font-weight: bold;">get</span> | <span style="font-family:monospace; font-weight: bold;">list</span> | <span style="font-family:monospace; font-weight: bold;">exists</span> | <span style="font-family:monospace; font-weight: bold;">number</span> | <span style="font-family:monospace; font-weight: bold;">all</span>)</div></div><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">
	    var_qs
	  </span>  (<span style="font-family:monospace; font-weight: bold;">get</span> | <span style="font-family:monospace; font-weight: bold;">list</span> | <span style="font-family:monospace; font-weight: bold;">exists</span> | <span style="font-family:monospace; font-weight: bold;">number</span> | <span style="font-family:monospace; font-weight: bold;">all</span>)</div></div><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">
	    var_post
	  </span>  (<span style="font-family:monospace; font-weight: bold;">get</span> | <span style="font-family:monospace; font-weight: bold;">list</span> | <span style="font-family:monospace; font-weight: bold;">exists</span> | <span style="font-family:monospace; font-weight: bold;">number</span> | <span style="font-family:monospace; font-weight: bold;">all</span>)</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  The <span style="font-family:monospace"><span><b class="command">var</b></span></span> command retrieves information
	  about GET or POST variables sent to the script via client
	  request.  It treats both GET and POST variables the same,
	  regardless of their origin.  Note that there are two
	  additional forms of <span style="font-family:monospace"><span><b class="command">var</b></span></span>:
	  <span style="font-family:monospace"><span><b class="command">var_qs</b></span></span> and <span style="font-family:monospace"><span><b class="command">var_post</b></span></span>.
	  These two restrict the retrieval of information to
	  parameters arriving via the querystring
	  (?foo=bar&amp;bee=bop) or POSTing, respectively.
	</p><div class="variablelist"><dl><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span>   <span style="font-family:monospace; font-weight: bold;">get</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>varname</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>?<span class="optional">default</span>?</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Returns the value of variable
		<i class="replaceable"><tt>varname</tt></i>
		as a string (even if there are multiple values).  If
		the variable doesn't exist as a GET or POST
		variable, the
		<i class="replaceable"><tt>?<span class="optional">default</span>?</tt></i>
		value is returned, otherwise "" - an empty string -
		is returned.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span>   <span style="font-family:monospace; font-weight: bold;">list</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>varname</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Returns the value of variable
		<i class="replaceable"><tt>varname</tt></i> as a
		list, if there are multiple values.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span>   <span style="font-family:monospace; font-weight: bold;">exists</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>varname</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Returns 1 if
		<i class="replaceable"><tt>varname</tt></i>
		exists, 0 if it doesn't.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span>   <span style="font-family:monospace; font-weight: bold;">number</span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Returns the number of variables.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">var</span>   <span style="font-family:monospace; font-weight: bold;">all</span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Return a list of variable names and values.
	      </div></div></dd></dl></div><p style="width:90%">
	  See <a href="#variable_access" title="Example3.Variable Access">Example3, &#8220;Variable Access&#8221;</a>.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4746026"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">upload &#8212; handle a file uploaded by a client.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">upload</span>  (<span style="font-family:monospace; font-weight: bold;">channel</span> | <span style="font-family:monospace; font-weight: bold;">save</span> | <span style="font-family:monospace; font-weight: bold;">data</span> | <span style="font-family:monospace; font-weight: bold;">exists</span> | <span style="font-family:monospace; font-weight: bold;">size</span> | <span style="font-family:monospace; font-weight: bold;">type</span> | <span style="font-family:monospace; font-weight: bold;">filename</span>)</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">The upload command is for file upload manipulation.
	  See the relevant Apache Directives to further configure the
	  behavior of this Rivet feature.</p><div class="variablelist"><dl><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">upload</span>   <span style="font-family:monospace; font-weight: bold;">channel</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>uploadname</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		When given the name of a file upload
		<i class="replaceable"><tt>uploadname</tt></i>,
		returns a Tcl channel that can be used to access the
		uploaded file.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">upload</span>   <span style="font-family:monospace; font-weight: bold;">save</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>uploadname</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>filename</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Saves the
		<i class="replaceable"><tt>uploadname</tt></i> in
		the file
		<i class="replaceable"><tt>filename</tt></i>.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">upload</span>   <span style="font-family:monospace; font-weight: bold;">data</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>uploadname</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Returns data uploaded to the server.  This is binary clean
		- in other words, it will work even with files like
		images, executables, compressed files, and so on.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">upload</span>   <span style="font-family:monospace; font-weight: bold;">size</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>uploadname</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Returns the size of the file uploaded.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">upload</span>   <span style="font-family:monospace; font-weight: bold;">type</span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		If the <tt class="varname">Content-type</tt> is set, it is
		returned, otherwise, an empty string.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">upload</span>   <span style="font-family:monospace; font-weight: bold;">filename</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>uploadname</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Returns the filename on the remote host that uploaded the file.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">upload</span>   <span style="font-family:monospace; font-weight: bold;">names</span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Returns the variable names, as a list, of all the files
		uploaded.
	      </div></div></dd></dl></div><p style="width:90%">
	  See <a href="#upload" title="Example4.File Upload">Example4, &#8220;File Upload&#8221;</a>.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4746450"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">load_response &#8212; load form variables into an array.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">load_response</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arrayName</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3>
	Load any form variables passed to this page into an
	array.
      </div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4746495"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">load_headers &#8212; get client request's headers.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">load_headers</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>array_name</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Load the headers that come from a client request into the
	  provided array name, or use headers if no
	  name is provided.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4746549"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">load_cookies &#8212; get any cookie variables sent by the client.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">load_cookies</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>array_name</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3></div><p style="width:90%">
	Load the array of cookie variables into the specified
	array name.  Uses array cookies by
	default.
      </p></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4746601"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">load_env &#8212; get the request's environment variables.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">load_env</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>array_name</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Load the array of environment variables into the specified
	  array name.  Uses array ::request::env by
	  default.
	</p><p style="width:90%">
	  As Rivet pages are run in the ::request
	  namespace, it isn't necessary to qualify the array name
	  for most uses - it's ok to access it as
	  env.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4746667"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">env &#8212; Loads a single
	"environmental variable" into a Tcl variable.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">env</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>varName</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  If it is only necessary to load one environmental variable,
	  this command may be used to avoid the overhead of loading
	  and storing the entire array.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4746717"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">include &#8212; includes a file into the output stream without modification.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">include</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>filename_name</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Include a file without parsing it for processing tags &lt;?
	  and ?&gt;.  This is the best way to include an HTML file or
	  any other static content.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4746771"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">parse &#8212; parses a Rivet template file.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">parse</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>filename</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Like the Tcl <span style="font-family:monospace"><span><b class="command">source</b></span></span> command, but also
	  parses for Rivet &lt;?  and ?&gt; processing tags.  Using
	  this command, you can use one .rvt file from another.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4746830"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">headers &#8212; set and parse HTTP headers.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span>  (<span style="font-family:monospace; font-weight: bold;">set</span> | <span style="font-family:monospace; font-weight: bold;">redirect</span> | <span style="font-family:monospace; font-weight: bold;">add</span> | <span style="font-family:monospace; font-weight: bold;">type</span> | <span style="font-family:monospace; font-weight: bold;">numeric</span>)</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  The <span style="font-family:monospace"><span><b class="command">headers</b></span></span> command is for setting and
	  parsing HTTP headers.
	</p><div class="variablelist"><dl><dt><span class="term"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span>   <span style="font-family:monospace; font-weight: bold;">set</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>headername</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Set arbitrary header names and values.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span>   <span style="font-family:monospace; font-weight: bold;">redirect</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>uri</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Redirect from the current page to a new
		URI. <span class="emphasis"><em>Must</em></span> be done in the first block
		of TCL code.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span>   <span style="font-family:monospace; font-weight: bold;">add</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>headername</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Add text to header
		<tt class="varname">headername</tt>.</div></div></dd><dt><span class="term"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span>   <span style="font-family:monospace; font-weight: bold;">type</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>content-type</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		This command sets the <tt class="constant">Content-type</tt>
		header returned by the script, which is useful if you wish
		to send content other than HTML with Rivet - PNG or jpeg
		images, for example.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span>   <span style="font-family:monospace; font-weight: bold;">numeric</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>response code</tt></i></span>?</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Set a numeric response code, such as 200, 404 or 500.
	      </div></div></dd></dl></div></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747164"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">makeurl &#8212; construct url's based on hostname, port.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">makeurl</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>filename</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Create a self referencing URL from a filename.  For example:
	  </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">makeurl /tclp.gif</pre><p style="width:90%">
	  returns
	  <tt class="computeroutput">http://[hostname]:[port]/tclp.gif</tt>.
	  where hostname and port are the hostname and port of the
	  server in question.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747227"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">cookie &#8212; get and set cookies.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">cookie</span>  ?<span style="font-family:monospace; font-weight: bold;">set</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>cookieName</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>?<span class="optional">cookiValue</span>?</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;">-days <i class="replaceable"><tt>expireInDays</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;">-hours <i class="replaceable"><tt>expireInHours</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;">-minutes <i class="replaceable"><tt>expireInMinutes</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;">-expires <i class="replaceable"><tt>Wdy, DD-Mon-YYYY HH:MM:SS GMT</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;">-path <i class="replaceable"><tt>uriPathCookieAppliesTo</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;">-secure <i class="replaceable"><tt>1/0</tt></i></span>?</div></div><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">cookie</span>  ?<span style="font-family:monospace; font-weight: bold;">get</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>cookieName</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  <span style="font-family:monospace"><span><b class="command">cookie</b></span></span> gets or sets a cookie.  When you
	  get a cookie, the command returns the value of the cookie,
	  or an empty string if no cookie exists.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747391"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">clock_to_rfc850_gmt &#8212; create a rfc850 time from [clock seconds].</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">clock_to_rfc850_gmt</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>seconds</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Convert an integer-seconds-since-1970 click value to
	  RFC850 format, with the additional requirement that it be
	  GMT only.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747441"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">html &#8212; construct html tagged text.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">html</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>string</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arg</tt></i></span>...?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Print text with the added ability to pass HTML tags
	  following the string.  Example:
	  </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">html "Test" b i</pre><p style="width:90%">
	  produces: <tt class="computeroutput">&lt;b&gt;&lt;i&gt;Test&lt;/i&gt;&lt;/b&gt;</tt>
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747511"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">incr0 &#8212; increment a variable or set it to 1 if nonexistant.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">incr0</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>varname</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>num</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Increment a variable
	  <i class="replaceable"><tt>varname</tt></i> by
	  <i class="replaceable"><tt>num</tt></i>.  If the
	  variable doesn't exist, create it instead of returning an
	  error.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747579"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">parray &#8212; Tcl's <span style="font-family:monospace"><span><b class="command">parray</b></span></span> with html formatting.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">parray</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arrayName</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>?<span class="optional">pattern</span>?</tt></i></span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  An html version of the standard Tcl
	  <span style="font-family:monospace"><span><b class="command">parray</b></span></span> command.  Displays the entire
	  contents of an array in a sorted, nicely-formatted way.
	  Mostly used for debugging purposes.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747650"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">abort_page &#8212; Stops outputing data to web page, similar in
	  purpose to PHP's <span style="font-family:monospace"><span><b class="command">die</b></span></span> command.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">abort_page</span> </div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">This command flushes the
	output buffer and stops the Tcl script from sending any more
	data to the client.  A normal Tcl script might use the
	<span style="font-family:monospace"><span><b class="command">exit</b></span></span> command, but that cannot be used in
	Rivet without actually exiting the apache child
	process!</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747705"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">no_body &#8212; Prevents Rivet from sending any content.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">no_body</span> </div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  This command is useful for situations where it is necessary
	  to only return HTTP headers and no actual content.  For
	  instance, when returning a 304 redirect.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747746"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">escape_string &#8212; convert a string into escaped characters.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">escape_string</span>  ?<span style="font-family:monospace; font-weight: bold;">string</span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Scans through each character in the specified string looking
	  for special characters, escaping them as needed, mapping
	  special characters to a quoted hexadecimal equivalent,
	  returning the result.
	</p><p style="width:90%">
	This is useful for quoting strings that are going to be
	part of a URL.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747800"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">escape_sgml_chars &#8212; escape special SGML characters in a string.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">escape_sgml_chars</span>  ?<span style="font-family:monospace; font-weight: bold;">string</span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Scans through each character in the specified string looking
	  for any special (with respect to SGML, and hence HTML) characters
	  from the specified string, and returns the result.  
	  For example, the right angle
	  bracket is escaped to the corrected ampersand gt symbol.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747852"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">escape_shell_command &#8212; escape shell metacharacters in a string.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">escape_shell_command</span>  ?<span style="font-family:monospace; font-weight: bold;">string</span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Scans through each character in the specified string looking
	  for any shell metacharacters, such as asterisk, less than and
	  greater than, parens, square brackets, curly brackets, angle 
	  brackets, dollar signs, backslashes, semicolons, ampersands,
	  vertical bars, etc.
	</p><p style="width:90%">
	  For each metacharacter found, it is quoted in the result by
	  prepending it with a backslash, returning the result.
	</p></div></div><div class="refentry" lang="en"><div class="refentry.separator"><hr></div><a name="id4747908"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">unescape_string &#8212; unescape escaped characters in a string.</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">unescape_string</span>  ?<span style="font-family:monospace; font-weight: bold;">string</span>?</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  Scans through each character in the specified string looking
	  for escaped character sequences (characters containing a
	  percent sign and two hexadecimal characters, unescaping them 
	  back to their original character values, as needed, also mapping
	  plus signs to spaces, and returning the result.
	</p><p style="width:90%">
	This is useful for unquoting strings that have been quoted to
	be part of a URL.
	</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="examples"></a>Examples and Usage</h2></div></div></div><p style="width:90%">
      Some examples of Rivet usage follow.  Some prior Tcl knowledge
      is assumed.  If you don't know much Tcl, don't worry, it's easy,
      and there are some good resources available on the web that will
      get you up to speed quickly.  Go to the <a href="#websites" title="Web Sites">web sites</a> section and have a look.
    </p><div class="example"><a name="hello world"></a><p class="title"><b>Example1.Hello World</b></p><p style="width:90%">
	As with any tool, it's always nice to see something work, so
	let's create a small "Hello World" page.</p><p style="width:90%">
	Assuming you have Apache configured correctly, create a file
	called <tt class="filename">hello.rvt</tt> where Apache can find
	it, with the following content:
      </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">&lt;?
puts "Hello World"
?&gt;
</pre><p style="width:90%">
	If you then access it with your browser, you should see a
	blank page with the text "Hello World" (without the quotes) on
	it.
      </p></div><div class="example"><a name="table"></a><p class="title"><b>Example2.Generate a Table</b></p><p style="width:90%">
	In another simple example, we dynamically generate a table:
      </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">&lt;? puts "&lt;table&gt;\n"
for {set i 1} { $i &lt;= 8 } {incr i} {
    puts "&lt;tr&gt;\n"
    for {set j 1} {$j &lt;= 8} {incr j} {
        set num [ expr $i * $j * 4 - 1]
        puts [ format "&lt;td bgcolor=\"%02x%02x%02x\" &gt; $num $num $num &lt;/td&gt;\n" \
		   $num $num $num ]
    }
    puts "&lt;/tr&gt;\n"
}
puts "&lt;/table&gt;\n" ?&gt;
</pre><p style="width:90%">
	If you read the code, you can see that this is pure Tcl.  We
	could take the same code, run it outside of Rivet, and it
	would generate the same HTML!
      </p><p style="width:90%">
	The result should look something like this:
      </p><div><img src="table.png"></div></div><div class="example"><a name="variable_access"></a><p class="title"><b>Example3.Variable Access</b></p><p style="width:90%">
	Here, we demonstrate how to access variables set by GET or
	POST operations.
      </p><p style="width:90%">
	Given an HTML form like the following:
      </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">     &lt;form action="vars.rvt"&gt;
      &lt;table&gt;
	&lt;tbody&gt;
	  &lt;tr&gt;
	    &lt;td&gt;&lt;b&gt;Title:&lt;/b&gt;&lt;/td&gt;
	    &lt;td&gt;&lt;input name="title"&gt;&lt;/td&gt;
	  &lt;/tr&gt;
	  &lt;tr&gt;
	    &lt;td&gt;&lt;b&gt;Salary:&lt;/b&gt;&lt;/td&gt;
	    &lt;td&gt;&lt;input name="salary"&gt;&lt;/td&gt;
	  &lt;/tr&gt;
	  &lt;tr&gt;
	    &lt;td&gt;&lt;b&gt;Boss:&lt;/b&gt;&lt;/td&gt;
	    &lt;td&gt;&lt;input name="boss"&gt;&lt;/td&gt;&lt;/tr&gt;
	  &lt;tr&gt;
	    &lt;td&gt;&lt;b&gt;Skills:&lt;/b&gt;&lt;/td&gt;
	    &lt;td&gt;
	      &lt;select name="skills" multiple="multiple"&gt;
		&lt;option&gt;c&lt;/option&gt;
		&lt;option&gt;java&lt;/option&gt;
		&lt;option&gt;Tcl&lt;/option&gt;
		&lt;option&gt;Perl&lt;/option&gt;
	      &lt;/select&gt;
	    &lt;/td&gt;
	  &lt;/tr&gt;
	  &lt;tr&gt;
	    &lt;td&gt;&lt;input type="submit"&gt;&lt;/td&gt;
	  &lt;/tr&gt;
	&lt;/tbody&gt;
      &lt;/table&gt;
    &lt;/form&gt;
</pre><p style="width:90%">
	We can use this Rivet script to get the variable values:
      </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">&lt;?
set errlist {}
if { [var exists title] } {
    set title [var get title]
} else {
    set errlist "You need to enter a title"
}

if { [var exists salary] } {
    set salary [var get salary]
    if { ! [string is digit $salary] } {
	lappend errlist "Salary must be a number"
    }
} else {
    lappend errlist "You need to enter a salary"
}

if { [var exists boss] } {
    set boss [var get boss]
} else {
    set boss "Mr. Burns"
}

if { [var exists skills] } {
    set skills [var list skills]
} else {
    lappend errlist "You need to enter some skills"
}

if { [llength $errlist] != 0 } {
    foreach err $errlist {
	puts "&lt;b&gt; $err &lt;/b&gt;"
    }
} else {
    puts "Thanks for the information!"
    ?&gt;
    &lt;table&gt;
      &lt;tbody&gt;
	&lt;tr&gt;
	  &lt;td&gt;&lt;b&gt;Title:&lt;/b&gt;&lt;/td&gt;
	  &lt;td&gt;&lt;? puts $title ?&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
	  &lt;td&gt;&lt;b&gt;Boss:&lt;/b&gt;&lt;/td&gt;
	  &lt;td&gt;&lt;? puts $boss ?&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
	  &lt;td&gt;&lt;b&gt;Salary:&lt;/b&gt;&lt;/td&gt;
	  &lt;td&gt;&lt;? puts $salary ?&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
	  &lt;td&gt;&lt;b&gt;Skills:&lt;/b&gt;&lt;/td&gt;
	  &lt;td&gt;&lt;? puts $skills ?&gt;&lt;/td&gt;
	&lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;?
}
?&gt;
</pre><p style="width:90%">
	The first statement checks to make sure that the
	<tt class="varname">boss</tt> variable has been passed to the
	script, and then does something with that information.  If
	it's not present, an error is added to the list of errors.
      </p><p style="width:90%">
	In the second block of code, the variable
	<tt class="varname">salary</tt> is fetched, with one more error
	check - because it's a number, it needs to be composed of
	digits.
      </p><p style="width:90%">
	The <tt class="varname">boss</tt> variable isn't required to have
	been sent - we set it to "Mr. Burns" if it isn't among the
	information we received.
      </p><p style="width:90%">
	The last bit of variable handing code is a bit trickier.
	Because <tt class="varname">skills</tt> is a listbox, and can
	potentially have multiple values, we opt to receive them as a
	list, so that at some point, we could iterate over them.
      </p><p style="width:90%">
	The script then checks to make sure that
	<tt class="varname">errlist</tt> is empty and outputting a thankyou
	message.  If <tt class="varname">errlist</tt> is not empty, the list
	of errors it contains is printed.
      </p></div><div class="example"><a name="upload"></a><p class="title"><b>Example4.File Upload</b></p><p style="width:90%">
	The following HTML in one file, say,
	<tt class="filename">upload.html</tt>
      </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">&lt;form action="foo.rvt" enctype="multipart/form-data" method="post"&gt;
&lt;input type="file" name="MyUpload"&gt;&lt;/input&gt;
&lt;input type="submit" value="Send File"&gt;&lt;/input&gt;
&lt;/form&gt;
</pre><p style="width:90%">
	Can be used with the following Tcl code, in a second file
	(<tt class="filename">upload.rvt</tt> for instance)
	in order to create a file upload form.
      </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">&lt;?
upload save MyUpload /tmp/uploadfiles/file1
puts "Saved file [upload filename MyUpload] \
	([upload size MyUpload] bytes) to server"
?&gt;</pre></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="tcl_packages"></a>Rivet Tcl Packages</h2></div></div></div><p style="width:90%">
      In addition to the core Apache module, Rivet provides a number
      of Tcl packages that include potentially useful code.
    </p><div class="itemizedlist"><ul type="disc"><li><div style="margin-bottom:1.5ex ; padding .5ex">commserver is a package providing a server that can be
	used for IPC.  Still experimental.  Requires the comm package
	from tcllib.</div></li><li><div style="margin-bottom:1.5ex ; padding .5ex">dio is a database abstraction layer.</div></li><li><div style="margin-bottom:1.5ex ; padding .5ex">dtcl is a compatibility package for mod_dtcl
	applications.</div></li><li><div style="margin-bottom:1.5ex ; padding .5ex">form - for creating forms.</div></li><li><div style="margin-bottom:1.5ex ; padding .5ex">rivet - some additional, useful routines.</div></li><li><div style="margin-bottom:1.5ex ; padding .5ex">tclrivet</div></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="dio"></a>DIO - Database Interface Objects</h2></div></div></div><div class="toc"><dl><dt><a href="#id4748222">DIO</a> - Database Interface Objects</dt></dl></div><div class="refentry" lang="en"><a name="id4748222"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">DIO &#8212; Database Interface Objects</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::DIO::handle</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>interface</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>? (<span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">...</span>)</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  <span style="font-family:monospace"><span><b class="command">DIO</b></span></span> is designed to be a generic,
	  object-oriented interface to SQL databases.  Its main goal
	  is to be as generic as possible, but since not all SQL
	  databases support the exact same syntaxes, keeping code
	  generic between databases is left to the abilities of the
	  programmer.  DIO simply provides a way to keep the Tcl
	  interface generic.
	</p><p style="width:90%">
	  interface - The name of the database
	  interface.  Currently supported interfaces are
	  Postgresql and Mysql.
	</p><p style="width:90%">
	  If <i class="replaceable"><tt>objectName</tt></i> is
	  specified, DIO creates an object of that name.  If there is
	  no <i class="replaceable"><tt>objectName</tt></i>
	  given, DIO will automatically generate a unique object ID
	</p></div><div class="refsect1" lang="en"><h3>Options</h3><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-host</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>hostname</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		The hostname of the computer to connect to.  If none
		is given, DIO assumes the local host.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-port</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>portNumber</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">The port number to connect to on hostname.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-user</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>username</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">The username you wish to login to the server as.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-pass</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>password</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">The password to login to the server with.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-db</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>database</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		The name of the database to connect to.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-table</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>tableName</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		The default table to use when using built-in commands
		for storing and fetching.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-keyfield</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>keyFieldname</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		The default field to use as the primary key when using
		built-in commands for storing and fetching.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-autokey</span>  (<span style="font-family:monospace; font-weight: bold;">1</span> | <span style="font-family:monospace; font-weight: bold;">0</span>)</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		If this option is set to 1, DIO will attempt to
		determine an automatic key for
		keyField when storing and fetching.
		In most databases, this requires that the
		sequence also be specified.  In the
		case of MySQL, where sequences do not exist, autokey
		must be used in conjunction with a table which has a
		field specified as AUTO.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-sequence</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>sequenceName</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		If DIO is automatically generating keys, it will use
		this sequence as a means to gain a unique number for
		the stored key.</div></div></dd></dl></div></div><div class="refsect1" lang="en"><h3>DIO Object Commands</h3><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">array</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>request</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Execute request as a SQL query and
		create an array from the first record found.  The
		array is set with the fields of the table and the
		values of the record found.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">autokey</span>? (<span style="font-family:monospace; font-weight: bold;">value</span> | <span style="font-family:monospace; font-weight: bold;">boolean</span>)</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current autokey value.  If
		value is specified, it sets a new
		value for the autokey option.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">close</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">	      Close the current database connection.  This command is
		automatically called when the DIO object is destroyed.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">db</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current database.  If
		value is specified, it sets a new
		value for the database.  In most cases, the DIO object
		will automatically connect to the new database when
		this option is changed.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">delete</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>key</tt></i></span>? (<span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">...</span>)</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Delete a record from the database where the primary
		key matches key.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">destroy</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Destroy the DIO object.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">errorinfo</span>? ?<span style="font-family:monospace; font-weight: bold;">value</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">errorinfo contains the value of
		the last error, if any, to occur while executing a
		request.  When a request fails for any reason, this
		variable is filled with the error message from the SQL
		interface package.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">exec</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>request</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Execute request as an SQL query.
		When the exec command is called, the query is
		executed, and a DIO result object is returned.  From
		there, the result object can be used to obtain
		information about the query status and records in a
		generic way.  See <a href="#resultobj" title="Result Object Commands">Result
		  Object Commands</a>
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">fetch</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>key</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arrayName</tt></i></span>? (<span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">...</span>)</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Fetch a record from the database where the primary key
		matches key and store the result in
		an array called arrayName.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">host</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current host value.  If
		value is specified, it sets a new
		value for the host.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">insert</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arrayName</tt></i></span>? (<span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">...</span>)</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Insert fields from arrayName into the specified table in the database.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">keyfield</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current keyfield.  If
		value is specified, it sets a new
		value for the keyfield.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">keys</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>pattern</tt></i></span>? (<span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">...</span>)</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return a list of keys in the database.  If
		pattern is specified, only the keys
		matching will be returned.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">lastkey</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the last key that was used from
		sequence.  If sequence has not been
		specified, this command returns an empty string.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">list</span>? ?<span style="font-family:monospace; font-weight: bold;">request</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Execute request as a SQL query and
		return a list of the first column of each record
		found.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">nextkey</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">Increment sequence and return the
		next key to be used.  If sequence has not been
		specified, this command returns an empty
		string.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">open</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">Open the connection to the current database.  This
		command is automatically called from any command which
		accesses the database.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">pass</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current pass value.  If
		value is specified, it sets a new
		value for the password.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">port</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">Return the current port value.  If value is
		specified, it sets a new value for the port.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">sequence</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current sequence value.  If value is
		specified, it sets a new value for the sequence.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">store</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arrayName</tt></i></span>? (<span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">...</span>)</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Store arrayName in the database, inserting it if the corresponding record isn't there, or updating it if it is.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">string</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>request</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Execute request as a SQL query and
		return a string containing the first record
		found.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">table</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">Return the current table.  If
		value is specified, it sets a new
		value for the table.</div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">user</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current user value.  If
		value is specified, it sets a new
		value for the user.
	      </div></div></dd></dl></div></div><div class="refsect1" lang="en"><a name="resultobj"></a><h3>Result Object Commands</h3><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">autocache</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current autocache value.  If
		value is specified, it sets a new
		value for autocache.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">
		If autocache is true, the result object will
		automatically cache rows as you use them.  This means
		that the first time you execute a forall command, each
		row is being cached in the result object itself and
		will no longer need to access the SQL result.
		<span class="emphasis"><em>Default is true</em></span>.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">cache</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Cache the results of the current SQL result in the
		result object itself.  This means that even if the
		database connection is closed and all the results of
		the DIO object are lost, this result object will still
		maintain a cached copy of its records.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">errorcode</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current errorcode value.  If value
		is specified, it sets a new value for errorcode.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">
		errorcode contains the current code from the
		SQL database which specifies the result of the query
		statement which created this object.  This variable
		can be used to determine the success or failure of a
		query.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">errorinfo</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current errorinfo value.  If value
		is specified, it sets a new value for errorinfo.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">
		If an error occurred during the SQL query, DIO
		attempts to set the value of errorinfo to the
		resulting error message.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">fields</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current fields value.  If
		value is specified, it sets a new
		value for fields.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">
		fields contains the list of fields
		used in this query.  The fields are in order of the
		fields retrieved for each row.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">forall</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>-type</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>varName</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>body</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Execute body over each record in the
		result object.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">Types:</div><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-array</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		      Create
		      <i class="replaceable"><tt>varName</tt></i>
		      as an array where the indexes are the names of
		      the fields in the table and the values are the
		      values of the current row.
		    </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-keyvalue</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		      Set
		      <i class="replaceable"><tt>varName</tt></i>
		      to a list containing key-value pairs of fields
		      and values from the current row. (-field value
		      -field value)
		    </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-list</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		      Set
		      <i class="replaceable"><tt>varName</tt></i>
		      to a list that contains the values of the
		      current row.
		    </div></div></dd></dl></div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">next</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>-type</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>varName</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Retrieve the next record in the result object.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">Types:</div><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-array</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		      Create
		      <i class="replaceable"><tt>varName</tt></i>
		      as an array where the indexes are the names of
		      the fields in the table and the values are the
		      values of the current row.
		    </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-keyvalue</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		      Set
		      <i class="replaceable"><tt>varName</tt></i>
		      to a list containing key-value pairs of fields
		      and values from the current row. (-field value
		      -field value)
		    </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-list</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		      Set
		      <i class="replaceable"><tt>varName</tt></i>
		      to a list that contains the values of the
		      current row.
		    </div></div></dd></dl></div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">numrows</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current numrows value.  If value is
		specified, it sets a new value for numrows.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">
		numrows is the number of rows in this result.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">resultid</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current resultid value.  If value is
		specified, it sets a new value for resultid.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">
		resultid in most databases is the result
		pointer which was given us by the database.  This
		variable is not generic and should not really be used,
		but it's there if you want it.
	      </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>resultObj</tt></i></span>  ?<span style="font-family:monospace; font-weight: bold;">rowid</span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the current rowid value.  If value is
		specified, it sets a new value for rowid.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">
		rowid contains the number of the
		current result record in the result object.  This
		variable should not really be accessed outside of the
		result object, but it's there if you want it.
	      </div></div></dd></dl></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="diodisplay"></a>DIODisplay - Database Interface Objects Display Class</h2></div></div></div><div class="toc"><dl><dt><a href="#id4750882">DIODisplay</a> - Database Interface Objects Display Class</dt></dl></div><div class="refentry" lang="en"><a name="id4750882"></a><div class="titlepage"></div><div class="refnamediv"><h3>Name</h3><p><h3 style="text-indent: 3em">DIODisplay &#8212; Database Interface Objects Display Class</h3></p></div><div class="refsynopsisdiv"><h3>Synopsis</h3><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">DIODisplay</span>  (<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">#auto</span>) (<span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span> | <span style="font-family:monospace; font-weight: bold;">...</span>)</div></div></div><div class="refsect1" lang="en"><h3>Description</h3><p style="width:90%">
	  DIODisplay is an HTML display class that uses a DIO object
	  to do the database work and a form object to do the
	  displaying.
	</p></div><div class="refsect1" lang="en"><h3>Options</h3><div class="variablelist"><dl><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-DIO</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>dioObject</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		The DIO object to be used in conjunction with this
		display object.  This is a required field.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-cleanup</span>  (<span style="font-family:monospace; font-weight: bold;">1</span> | <span style="font-family:monospace; font-weight: bold;">0</span>)</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		If cleanup is true, when the display object is shown,
		it will automatically destroy the DIO object, the form
		object and itself. Default is true.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-confirmdelete</span>  (<span style="font-family:monospace; font-weight: bold;">1</span> | <span style="font-family:monospace; font-weight: bold;">0</span>)</div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		If confirmdelete is true, attempting to delete a
		record from the database first requires that the user
		confirm that they wish to delete it.  If it is false,
		deletion occurs without prompting the user. Defaults
		to true.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-errorhandler</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>procName</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		The name of a procedure to handle errors when they
		occur.  During the processing of requests and pages,
		sometimes unexpected errors can occur.  This procedure
		will handle any errors.  It is called with a single
		argument, the error string.  Use of the Tcl errorInfo
		and errorCode variables is also recommended though.
	      </div><div style="margin-bottom:1.5ex ; padding .5ex">
		If no errorhandler is specified, the handle_error
		method within the Display object will handle the
		error.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-fields</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>fieldList</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Specify a list of fields to be used in this object.
		The fields list is actually created by using the
		<span style="font-family:monospace"><span><b class="command">field</b></span></span> command to add fields to the
		display, but this option can be useful to sometimes
		over-set the list of fields created.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-form</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>formObject</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		A Rivet form object to use when displaying a form.  If
		one is not specified, the display object will
		automatically create one when it is necessary.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-functions</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>functionList</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		A list of functions to be displayed in the main menu.
		This is a list of functions the user is allowed to
		execute.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-pagesize</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>pageSize</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		How many records to show per page on a search or
		list. Default is 25.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-rowfields</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>fieldList</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		A list of fields to display in each row of a search or
		list.  When a search or list is conducted and the
		resulting rows are displayed, this list will limit
		which fields are displayed.  Default is all fields.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-rowfunctions</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>functionList</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		A list of functions to display in each row of a search
		or list.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-searchfields</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>fieldList</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		A list of fields to allow a user to search by.  This
		list will appear in the main screen as a drop-down box
		of fields the user can search on.
	      </div></div></dd><dt><span class="term">
	      <div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-title</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>title</tt></i></span> </div></div>
	    </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		The title of the display object.  This will be output
		as the title of the HTML document.
	      </div></div></dd></dl></div><div class="refsect2" lang="en"><h3>DIO Display Object Commands</h3><div class="variablelist"><dl><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">cleanup</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current cleanup value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for the cleanup
		  option.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">delete</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>key</tt></i></span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Delete the specified key from the
		  database.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  The default action of this method is to call the DIO
		  object's delete command.  This method can be
		  overridden.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">destroy</span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Destroy the diodisplay object.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">DIO</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current DIO value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for DIO.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">errorhandler</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current errorhandler value.  If
		  <i class="replaceable"><tt>value</tt></i> is specified, it
		  sets a new value for errorhandler.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">fetch</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>key</tt></i></span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arrayName</tt></i></span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Fetch the specified <i class="replaceable"><tt>key</tt></i>
		  from the database and store it as an array in
		  <i class="replaceable"><tt><i class="replaceable"><tt>arrayName</tt></i></tt></i>.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  The default of this method is to call the DIO object's fetch command.
		  This method can be overridden.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">field</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>fieldName</tt></i></span>  (<span style="font-family:monospace; font-weight: bold;">-arg</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arg</tt></i></span>...)</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Create a new field object and add it to the display.
		  When a field is added to the display, a new object
		  of the DIODisplayField class is created with its
		  values.  See [FIXME - LINK] DIO Display Fields for
		  options and values.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">fields</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current fields value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for fields.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">form</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current form value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for form.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">function</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>functionName</tt></i></span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Add a new function to the list of possible
		  functions.  The display object will only execute
		  methods and procs which are defined as functions by
		  the object.  This is to protect the program from
		  executing a different procedure other than what is
		  allowed.  The <span style="font-family:monospace"><span><b class="command">function</b></span></span> command
		  adds a new function to the list of allowable
		  functions.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">functions</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current functions value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for functions.  See
		  [FIXME - LINK DIO Display Functions] for a list of
		  default functions.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">pagesize</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current form pagesize.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for pagesize.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">rowfields</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current form rowfields.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for rowfields.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">rowfooter</span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Output the footer of a list of rows to the web page.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This method can be overridden.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">rowfunctions</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current rowfunctions value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for rowfunctions.
		  
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">rowheader</span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Output the header of a list of rows to the web page.
		By default, this is an HTML table with a top row
		listing the fields in the table.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This method can be overridden.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">searchfields</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current searchfields value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for searchfields.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">show</span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Show the display object.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This is the main method of the display class.  It
		  looks for a variable called <tt class="varname">mode</tt>
		  to be passed in through a form response and uses
		  that mode to execute the appropriate function.  If
		  mode is not given, the <span style="font-family:monospace"><span><b class="command">Main</b></span></span>
		  function is called.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This function should be called for every page.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">showform</span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Display the form of the object.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This method displays the form for this display
		  object.  It is used in the <span style="font-family:monospace"><span><b class="command">Add</b></span></span>
		  and <span style="font-family:monospace"><span><b class="command">Edit</b></span></span> methods but can be
		  called separately if needed.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This method can be overridden if the default look of
		  a form needs to be changed.  By default, the form
		  displayed is simply the fields in a table, in order.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">showrow</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arrayName</tt></i></span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Display a single row of a resulting list or search.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This method is used to display a single row while
		  displaying the result of a list or search.
		  <i class="replaceable"><tt>arrayName</tt></i>
		  is a fetched array of the record.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This method can be overriden if the default look of
		  a row needs to be changed.  By default, each row is
		  output as a table row with each field as a table
		  data cell.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">showview</span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Display the view of the object.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This method displays the view for this display
		  object.  It is used in the
		  <span style="font-family:monospace"><span><b class="command">Details</b></span></span> methods but can be
		  called separately if needed.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  This method can be overridden if the default look of
		  a view needs to be changed.  By default, the view
		  displayed is simply the fields in a table, in order.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">store</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arrayName</tt></i></span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Store the specified
		  <i class="replaceable"><tt>arrayName</tt></i>
		  in the database.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  The default of this method is to call the DIO
		  object's store command.  This method can be
		  overridden.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">text</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current text value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for text.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">title</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current title value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for title.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">type</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current type value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for type.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>objectName</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">value</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>value</tt></i></span>?</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Return the current value value.  If
		  <i class="replaceable"><tt>value</tt></i> is
		  specified, it sets a new value for value.
		</div></div></dd></dl></div></div><div class="refsect2" lang="en"><h3>DIO Display Functions</h3><p style="width:90%">
	    These functions are called from the
	    <span style="font-family:monospace"><span><b class="command">show</b></span></span> method when a form response
	    variable called <tt class="varname">mode</tt> is set.  If no
	    mode has been set, the default mode is
	    <span style="font-family:monospace"><span><b class="command">Main</b></span></span>.  The show method will handle
	    the necessary switching of functions.  The show method
	    also handles checking to make sure the function given is a
	    true function.  If not, an error message is displayed.
	    New functions can be added as methods or by use of the
	    <span style="font-family:monospace"><span><b class="command">function</b></span></span> command, and any of the
	    default functions can be overridden with new methods to
	    create an entirely new class.  These are the default
	    functions provided.
	  </p><div class="variablelist"><dl><dt><span class="term"><span style="font-family:monospace"><span><b class="command">Add</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Show a form that allows the user to add a new entry
		  to the database.  This function calls
		  <span style="font-family:monospace"><span><b class="command">showform</b></span></span> to display the form
		  for adding the entry.
		</div></div></dd><dt><span class="term"><span style="font-family:monospace"><span><b class="command">Cancel</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  The <span style="font-family:monospace"><span><b class="command">Cancel</b></span></span> function does nothing
		  but redirect back to the <span style="font-family:monospace"><span><b class="command">Main</b></span></span>
		  function.  This is handy for forms which have a
		  cancel button to point to.
		</div></div></dd><dt><span class="term"><span style="font-family:monospace"><span><b class="command">Delete</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  If <tt class="varname">confirmdelete</tt> is true (the
		  default), the <span style="font-family:monospace"><span><b class="command">Delete</b></span></span> function
		  will ask the user if they're sure they want to
		  delete the record from the database.  If
		  <tt class="varname">confirmdelete</tt> is false, or if the
		  user confirms they wish to delete, this function
		  calls the <span style="font-family:monospace"><span><b class="command">DoDelete</b></span></span> function to do
		  the actual deletion of a record.
		</div></div></dd><dt><span class="term"><span style="font-family:monospace"><span><b class="command">Details</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Display the view of a single record from the database.  This function calls
		  the <span style="font-family:monospace"><span><b class="command">showview</b></span></span> method to display a single record from the database.
		</div></div></dd><dt><span class="term"><span style="font-family:monospace"><span><b class="command">DoDelete</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  This function actually deletes a record from the
		  database.  Once it has deleted the record, it
		  redirects the user back to the
		  <span style="font-family:monospace"><span><b class="command">Main</b></span></span> function.
		</div></div></dd><dt><span class="term"><span style="font-family:monospace"><span><b class="command">Edit</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  Show a form that allows the user to edit an existing
		  entry to the database.  This function calls
		  <span style="font-family:monospace"><span><b class="command">showform</b></span></span> to display the form for
		  editing the entry and fills in the fields with the
		  values retrieved from the database.
		</div></div></dd><dt><span class="term"><span style="font-family:monospace"><span><b class="command">List</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  This function lists the entires contents of the
		  database.  Each record is output in a row using the
		  <span style="font-family:monospace"><span><b class="command">showrow</b></span></span> method.
		</div></div></dd><dt><span class="term"><span style="font-family:monospace"><span><b class="command">Main</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  This function is the main function of the display
		  object.  If there is no mode, or once most commands
		  complete, the user will be redirected to this
		  function.  The default <span style="font-family:monospace"><span><b class="command">Main</b></span></span>
		  function displays a list of functions the user can
		  execute, a list of searchfields the user can search
		  on, and a query field.  This query field is used by
		  all of the other functions to determine what the
		  user is trying to find.
		</div><div style="margin-bottom:1.5ex ; padding .5ex">
		  In the case of a <span style="font-family:monospace"><span><b class="command">search</b></span></span>, query
		  specifies what string the user is looking for in the
		  specified search field.  In the case of
		  <span style="font-family:monospace"><span><b class="command">delete</b></span></span>,
		  <span style="font-family:monospace"><span><b class="command">details</b></span></span> or
		  <span style="font-family:monospace"><span><b class="command">edit</b></span></span>, the query specifies the
		  database key to access.
		</div></div></dd><dt><span class="term"><span style="font-family:monospace"><span><b class="command">Save</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  This function saves any data passed to using the
		  <span style="font-family:monospace"><span><b class="command">store</b></span></span> method.  This is primarily
		  used by the <span style="font-family:monospace"><span><b class="command">add</b></span></span> and
		  <span style="font-family:monospace"><span><b class="command">edit</b></span></span> commands to store the
		  results of the form the user has filled out.
		</div></div></dd><dt><span class="term"><span style="font-family:monospace"><span><b class="command">Search</b></span></span></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  This function searches the database for any row
		  whose <tt class="varname">searchBy</tt> field matches
		  <tt class="varname">query</tt>. Once any number of records
		  are found, <span style="font-family:monospace"><span><b class="command">Search</b></span></span> displays the
		  results in rows.
		</div></div></dd></dl></div></div><div class="refsect2" lang="en"><h3>DIO Display Fields</h3><p style="width:90%">
	    Display fields are created with the
	    <span style="font-family:monospace"><span><b class="command">field</b></span></span> command of the DIODisplay object.
	    Each field is created as a new DIODisplayField object or
	    as a subclass of DIODisplayField.  The standard form
	    fields use the standard field class, while specialized
	    field types use a class with different options but still
	    supports all of the same commands and values a generic
	    field does.
	  </p><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace"><i class="replaceable"><tt>displayObject</tt></i></span>   <span style="font-family:monospace; font-weight: bold;">field</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>fieldname</tt></i></span>  (<span style="font-family:monospace; font-weight: bold;">-option</span> | <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>option</tt></i></span>...)</div></div><p style="width:90%">
	    These are the standard options supported by field types:
	  </p><div class="variablelist"><dl><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-formargs</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>arguments</tt></i></span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  When a field is created, any argument which is not a
		  standard option is assumed to be an argument passed
		  to the form object when the field is shown in a
		  form.  These arguments are all appended to the
		  <tt class="varname">formargs</tt> variable.  You can use
		  this option to override or add options after the
		  initial creation of an object
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-readonly</span>  (<span style="font-family:monospace; font-weight: bold;">1</span> | <span style="font-family:monospace; font-weight: bold;">0</span>)</div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  If <tt class="varname">readonly</tt> is set to true, the
		  field will not display a form entry when displaying
		  in a form.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-text</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>text</tt></i></span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  The text displayed next to the form or view field.
		  By default, DIODisplay tries to figure out a pretty
		  way to display the field name.  This text will
		  override that default and display whatever is
		  specified.
		</div></div></dd><dt><span class="term">
		<div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-type</span>   <span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>fieldType</tt></i></span> </div></div>
	      </span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		  The type of field this is.  This type is used when
		  creating the field in the form object.
		  <i class="replaceable"><tt>fieldType</tt></i>
		  can be any of the accepted form field types.  See
		  [FIXME - LINK DIO Field Types] for a list of types
		  available.
		</div></div></dd></dl></div><p style="width:90%">
	    All other arguments, unless specified in an individual
	    field type, are passed directly to the form object when
	    the field is created.  So, you can pass
	    -size or -maxsize to
	    specify the length and maximum length of the field entry.
	    Or, if type were textarea, you could define
	    -rows and -cols to
	    specify its row and column count.
	  </p></div><div class="refsect2" lang="en"><h3>DIO Display Field Types</h3><p style="width:90%">
	    The following is a list of recognized field types by
	    DIODisplay.  Some are standard HTML form fields, and
	    others are DIODisplay fields which execute special actions
	    and functions.
	  </p></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="session_package"></a>Session Package</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="#id4753522">Introduction</a></span></dt><dt><span class="section"><a href="#id4753560">Requirements</a></span></dt><dt><span class="section"><a href="#id4753573">Preparing To Use It</a></span></dt><dt><span class="section"><a href="#id4753623">Example Usage</a></span></dt><dt><span class="section"><a href="#id4753689">Using Sessions From Your Code</a></span></dt><dt><span class="section"><a href="#id4753897">Session Configuration Options</a></span></dt><dt><span class="section"><a href="#id4754151">Session Methods</a></span></dt><dt><span class="section"><a href="#id4754390">Getting Additional Randomness From The Entropy File</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4753522"></a>Introduction</h3></div></div></div><p style="width:90%">
	This is session management code.  It provides an interface
	to allow you to generate and track a browser's visit as a
	"session", giving you a unique session ID and an interface
	for storing and retrieving data for that session on the
	server.
      </p><p style="width:90%">
	This is an alpha/beta release -- documentation is not in
	final form, but everything you need should be in this file.
      </p><p style="width:90%">
	Using sessions and their included ability to store and
	retrieve session-related data on the server, programmers can
	generate more secure and higher-performance websites.  For
	example, hidden fields do not have to be included in forms
	(and the risk of them being manipulated by the user
	mitigated) since data that would be stored in hidden fields
	can now be stored in the session cache on the server.  Forms
	are then faster since no hidden data is transmitted --
	hidden fields must be sent twice, once in the form to the
	broswer and once in the response from it.
      </p><p style="width:90%">
	Robust login systems, etc, can be built on top of this code.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4753560"></a>Requirements</h3></div></div></div><p style="width:90%">
	  Rivet.  Currently has only been tested with Postgresql.
	  All DB interfacing is done through DIO, though, so it
	  should be relatively easy to add support for other
	  databases.
	</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4753573"></a>Preparing To Use It</h3></div></div></div><p style="width:90%">Create the tables in your SQL server.  With Postgres,
	  do a <span style="font-family:monospace"><span><b class="command">psql www</b></span></span> or whatever DB you
	  connect as, then a backslash-i on
	  <tt class="filename">session-create.sql</tt></p><p style="width:90%">(If you need to delete the tables, use <tt class="filename">session-drop.sql</tt>)</p><p style="width:90%">The session code by default requires a DIO handle
	  called <tt class="varname">DIO</tt> (the name of which can be
	  overridden).  We get it by doing a</p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">
  RivetServerConf ChildInitScript "package require DIO"
  RivetServerConf ChildInitScript "::DIO::handle Postgresql DIO -user www"
</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4753623"></a>Example Usage</h3></div></div></div><p style="width:90%">In your httpd.conf, add:</p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">RivetServerConf ChildInitScript "package require Session; Session SESSION"</pre><p style="width:90%">
	  This tells Rivet you want to create a session object named
	  SESSION in every child process Apache creates.</p><p style="width:90%">
	  You can configure the session at this point using numerous
	  key-value pairs (which are defined later in this doc).
	  Here's a quick example:</p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">RivetServerConf ChildInitScript "package require Session; Session SESSION \
  -cookieLifetime 120 -debugMode 1"</pre><p style="width:90%">
	  Turn debugging on -debugMode 1 to figure
	  out what's going on -- it's really useful, if
	  verbose.</p><p style="width:90%">
	  In your .rvt file, when you're generating the &lt;HEAD&gt;
	  section:
	</p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">SESSION activate</pre><p style="width:90%">
	  Activate handles everything for you with respect to
	  creating new sessions, and for locating, validating, and
	  updating existing sessions.  Activate will either locate
	  an existing session, or create a new one.  Sessions will
	  automatically be refreshed (their lifetimes extended) as
	  additional requests are received during the session, all
	  under the control of the key-value pairs controlling the
	  session object.
	</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4753689"></a>Using Sessions From Your Code</h3></div></div></div><p style="width:90%">The main methods your code will use are:</p><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION</span> <span style="font-weight:bold ; font-family:monospace">id</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		After doing a <span style="font-family:monospace"><span><b class="command">SESSION activate</b></span></span>,
		this will return a 32-byte ASCII-encoded random
		hexadecimal string.  Every time this browser comes
		to us with a request within the timeout period, this
		same string will be returned (assuming they have
		cookies enabled).
	      </div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION</span> <span style="font-weight:bold ; font-family:monospace">is_new_session</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">returns 1 if it's a new session or 0 if it has
		previously existed (i.e. it's a zero if this request
		represents a "return" or subsequent visit to a
		current session.)</div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION new_session_reason</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		This will return why this request is the first
		request of a new session, either "no_cookie" saying
		the browser didn't give us a session cookie,
		"no_session" indicating we got a cookie but couldn't
		find it in our session table, or "timeout" where
		they had a cookie and we found the matching session
		but the session has timed out.
	      </div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION store</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>packageName</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>key</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>data</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Given the name of a package, a key, and some data.
		Stores the data in the rivet session cache table.
	      </div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION fetch</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>packageName</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>key</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Given a package name and a key, return the data
		stored by the store method, or an empty string if
		none was set.  (Status is set to the DIO error that
		occurred, it can be fetched using the status
		method.)
	      </div></div></dd></dl></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4753897"></a>Session Configuration Options</h3></div></div></div><p style="width:90%">The following key-value pairs can be specified when a
	  session object (like SESSION above) is created:</p><div class="variablelist"><dl><dt><span class="term">sessionLifetime</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">how many seconds the session will live for.
		7200 == 2 hours
	      </div></div></dd><dt><span class="term">sessionRefreshInterval</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		If a request is processed for a browser that
		currently has a session and this long has elapsed
		since the session update time was last updated,
		update it.  900 == 15 minutes.  so if at least 15
		minutes has elapsed and we've gotten a new request
		for a page, update the session update time,
		extending the session lifetime (sessions that are in
		use keep getting extended).
	      </div></div></dd><dt><span class="term">cookieName</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex"></div>
	      name of the cookie stored on the user's web browser
	      default rivetSession
	    </div></dd><dt><span class="term">dioObject</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		The name of the DIO object we'll use to access the
		database (default DIO)
	      </div></div></dd><dt><span class="term">gcProbability</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		The probability that garbage collection will occur
		in percent.  (default 1%, i.e. 1)</div></div></dd><dt><span class="term">gcMaxLifetime</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">the number of seconds after which
		data will be seen as "garbage" and cleaned up --
		defaults to 1 day (86400)</div></div></dd><dt><span class="term">refererCheck</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">The substring you want to check each
		HTTP referer for.  If the referer was sent by the
		browser and the substring is not found, the session
		will be deleted. (not coded yet)</div></div></dd><dt><span class="term">entropyFile</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">The
		name of a file that random binary data can be read
		from.  (<tt class="filename">/dev/urandom</tt>) Data will
		be used from this file to help generate a
		super-hard-to-guess session ID.</div></div></dd><dt><span class="term">entropyLength</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">The number of bytes which will be
		read from the entropy file.  If 0, the entropy file
		will not be read (default 0)</div></div></dd><dt><span class="term">scrambleCode</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
		Set the scramble code to something unique for the
		site or your app or whatever, to slightly increase
		the unguessability of session ids (default "some
		random string")</div></div></dd><dt><span class="term">cookieLifetime</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">The lifetime of the cookie in
		minutes.  0 means until the browser is closed (I
		think). (default 0)</div></div></dd><dt><span class="term">cookiePath</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">The
		webserver subpath that the session cookie applies to
		(defaults to
		<tt class="filename">/</tt>)</div></div></dd><dt><span class="term">cookieDomain</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">The domain to set in the session cookie
	  (FIXME - not coded yet)</div></div></dd><dt><span class="term">cookieSecure</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Specifies whether the cookie should
		only be sent over secure connections, 0 = any, 1 =
		secure connections only (default
		0)</div></div></dd><dt><span class="term">sessionTable</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">The name of the table that session
		info will be stored in (default
		<tt class="varname">rivet_session</tt>)</div></div></dd><dt><span class="term">sessionCacheTable</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">The name of the table that contains
		cached session data (default
		<tt class="varname">rivet_session_cache</tt>)</div></div></dd><dt><span class="term">debugMode</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Set
		debug mode to 1 to trace through and see the session
		object do its thing (default 0)</div></div></dd><dt><span class="term">debugFile</span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">The
		file handle that debugging messages will be written
		to (default
		<tt class="varname">stdout</tt>)
	      </div></div></dd></dl></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754151"></a>Session Methods</h3></div></div></div><p style="width:90%">
	  The following methods can be invoked to find out
	  information about the current session, store and fetch
	  server data identified with this session, etc:
	</p><div class="variablelist"><dl><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION status</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Return the status of the last operation
	      </div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION id</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Get the session ID of the current browser.  Returns
		an empty string if there's no session (will not
		happen is SESSION activate has been issued.)
	      </div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION new_session_reason</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Returns the reason why there wasn't a previous
		session, either "no_cookie" saying the browser
		didn't give us a session cookie, "no_session"
		indicating we got a cookie but couldn't find it in
		the session table, or "timeout" when we had a cookie
		and a session but the session had timed out.
	      </div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION store</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>packageName</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>key</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>data</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Given a package name, a key string, and a data
		string, store the data in the rivet session
		cache.
	      </div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION fetch</span>  ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>packageName</tt></i></span>? ?<span style="font-family:monospace; font-weight: bold;"><i class="replaceable"><tt>key</tt></i></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Given a package name and a key, return the data
		stored by the store method, or an empty string if
		none was set.  Status is set to the DIO error that
		occurred, it can be fetched using the status
		method.
	      </div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION delete</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Given a user ID and looking at their IP address we
		inherited from the environment (thanks, Apache),
		remove them from the session table.  (the session
		table is how the server remembers stuff about
		sessions). If the session ID was not specified the
		current session is deleted.
	      </div></div></dd><dt><span class="term"></span></dt><dd><div style="padding:4 ; margin-top:3 ;  margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#bbbbff ; margin:1ex ; padding:.4ex ;  word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">SESSION activate</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
		Find and validate the session ID if they have one.
		If they don't have one or it isn't valid (timed out,
		etc), create a session and drop a cookie on
		them.
	      </div></div></dd></dl></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754390"></a>Getting Additional Randomness From The Entropy File</h3></div></div></div><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">RivetServerConf ChildInitScript "Session SESSION -entropyFile /dev/urandom \
  -entropyLength 10 -debugMode 1"</pre><p style="width:90%">
	  This options say we want to get randomness from an entropy
	  file (random data pseudo-device) of /dev/urandom, to get ten
	  bytes of random data from that entropy device, and to turn
	  on debug mode, which will cause the SESSION object to output
	  all manner of debugging information as it does stuff.  This
	  has been tested on FreeBSD and appears to work.
      </p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="help"></a>Resources - How to Get Help</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="#id4754425">Mailing Lists</a></span></dt><dt><span class="section"><a href="#id4754470">Newsgroup</a></span></dt><dt><span class="section"><a href="#websites">Web Sites</a></span></dt><dt><span class="section"><a href="#id4754556">Bug Tracking System</a></span></dt><dt><span class="section"><a href="#id4754574">IRC</a></span></dt><dt><span class="section"><a href="#id4754586">Editing Rivet Template Files</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754425"></a>Mailing Lists</h3></div></div></div><p style="width:90%">
	The Rivet mailing list is the first place you should turn for
	help, if you haven't found the solution to your problem in the
	documentation.  Send email to
	<tt class="email">&lt;<a href="mailto:rivet-dev@tcl.apache.org">rivet-dev@tcl.apache.org</a>&gt;</tt>.  If you have a
	question, idea, or comment about the Rivet code itself, please
	send us email at <tt class="email">&lt;<a href="mailto:rivet-dev@tcl.apache.org">rivet-dev@tcl.apache.org</a>&gt;</tt>.  To
	subscribe to either list, post email to
	<tt class="email">&lt;<a href="mailto:rivet-list-subscribe@tcl.apache.org">rivet-<i class="replaceable"><tt>list</tt></i>-subscribe@tcl.apache.org</a>&gt;</tt>,
	where <i class="replaceable"><tt>list</tt></i> is either dev or user.
	Currently, dev is the preferred list to use.
      </p><p style="width:90%">
	The mailing list archives are available at <a href="http://mail-archives.apache.org/eyebrowse/SummarizeList?listId=118" target="_top">http://mail-archives.apache.org/eyebrowse/SummarizeList?listId=118</a>
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754470"></a>Newsgroup</h3></div></div></div><p style="width:90%">
	The <a href="news:comp.lang.tcl" target="_top">news:comp.lang.tcl</a> newsgroup is a good
	place to ask about Tcl questions in general.  Rivet developers
	also follow the newsgroup, but it's best to ask Rivet-specific
	questions on the Rivet list.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="websites"></a>Web Sites</h3></div></div></div><p style="width:90%">
	There are several web sites that cover Apache and Tcl
	extensively.
      </p><div class="itemizedlist"><ul type="disc"><li><div style="margin-bottom:1.5ex ; padding .5ex">
	    <a href="http://tcl.apache.org" target="_top">http://tcl.apache.org</a> is the home for the
	    Apache Tcl project.  Go there for the latest versions of
	    our software (if you aren't reading these pages off of the
	    site!).
	  </div></li><li><div style="margin-bottom:1.5ex ; padding .5ex">
	    <a href="http://httpd.apache.org/docs/" target="_top">http://httpd.apache.org/docs/</a> is the first
	    place to go for questions about the Apache web server.
	  </div></li><li><div style="margin-bottom:1.5ex ; padding .5ex">
	    <a href="http://www.tcl.tk" target="_top">http://www.tcl.tk</a> is the canonical site
	    for Tcl information.
	  </div></li><li><div style="margin-bottom:1.5ex ; padding .5ex">
	    <a href="http://wiki.tcl.tk" target="_top">http://wiki.tcl.tk</a> is the Tcl'ers Wiki, a
	    free-form place to search for answers and ask for help.
	  </div></li></ul></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754556"></a>Bug Tracking System</h3></div></div></div><p style="width:90%">
	Apache Rivet uses the Apache Bug Tracking system at <a href="http://issues.apache.org/bugzilla/" target="_top">http://issues.apache.org/bugzilla/</a>.  Here,
	you can report problems, or check and see if existing issues
	are already known and being dealt with.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754574"></a>IRC</h3></div></div></div><p style="width:90%">
        Occasionally, someone from the Rivet team is on IRC at
        irc.freenode.net, channel #tcl.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754586"></a>Editing Rivet Template Files</h3></div></div></div><p style="width:90%">
	Rivet makes available code for two popular editors,
	<span class="application">emacs</span> and
	<span class="application">vim</span> to facilitate the editing of
	Rivet template files.  The key concept is that the editor is
	aware of the &lt;? and ?&gt; tags and switches back and forth
	between Tcl and HTML modes as the cursor moves.  These files,
	<tt class="filename">two-mode-mode.el</tt> and
	<tt class="filename">rvt.vim</tt> are available in the
	<tt class="filename">contrib/</tt> directory.
      </p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="internals"></a>Rivet Internals</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="#id4754656">Initialization</a></span></dt><dt><span class="section"><a href="#id4754694">RivetChan</a></span></dt><dt><span class="section"><a href="#id4754721">The <span style="font-family:monospace"><span><b class="command">global</b></span></span> Command</a></span></dt><dt><span class="section"><a href="#id4754773">Page Parsing, Execution and Caching</a></span></dt><dt><span class="section"><a href="#id4754823">Debugging Rivet and Apache</a></span></dt></dl></div><p style="width:90%">
      This section easily falls out of date, as new code is added, old
      code is removed, and changes are made.  The best place to look
      is the source code itself.  If you are interested in the changes
      themselves, <span style="font-family:monospace"><span><b class="command">cvs</b></span></span> can provide you with
      information about what has been happening with the code.
    </p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754656"></a>Initialization</h3></div></div></div><p style="width:90%">
	When Apache is started, (or when child Apache processes are
	started if a threaded Tcl is used),
	<tt class="function">Rivet_InitTclStuff</tt> is called, which
	creates a new interpreter, or one interpreter per virtual
	host, depending on the configuration. It also initializes
	various things, like the <span class="structname">RivetChan</span>
	channel system, creates the Rivet-specific Tcl commands, and
	executes Rivet's <tt class="filename">init.tcl</tt>.  The caching
	system is also set up, and if there is a
	<span style="font-family:monospace"><span><b class="command">GlobalInitScript</b></span></span>, it is run.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754694"></a>RivetChan</h3></div></div></div><p style="width:90%">
	The <span class="structname">RivetChan</span> system was created in
	order to have an actual Tcl channel that we could redirect
	standard output to.  This lets us use, for instance, the
	regular <span style="font-family:monospace"><span><b class="command">puts</b></span></span> command in .rvt pages.  It
	works by creating a channel that buffers output, and, at
	predetermined times, passes it on to Apache's IO system.
	Tcl's regular standard output is replaced with an instance of
	this channel type, so that, by default, output will go to the
	web page.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754721"></a>The <span style="font-family:monospace"><span><b class="command">global</b></span></span> Command</h3></div></div></div><p style="width:90%">
	Rivet aims to run standard Tcl code with as few surprises as
	possible.  At times this involves some compromises - in this
	case regarding the <span style="font-family:monospace"><span><b class="command">global</b></span></span> command.  The
	problem is that the command will create truly global
	variables.  If the user is just cut'n'pasting some Tcl code
	into Rivet, they most likely just want to be able to share the
	variable in question with other procs, and don't really care
	if the variable is actually persistant between pages.  The
	solution we have created is to create a proc
	<span style="font-family:monospace"><span><b class="command">::request::global</b></span></span> that takes the place of
	the <span style="font-family:monospace"><span><b class="command">global</b></span></span> command in Rivet templates.  If
	you really need a true global variable, use either
	<span style="font-family:monospace"><span><b class="command">::global</b></span></span> or add the :: namespace qualifier
	to variables you wish to make global.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754773"></a>Page Parsing, Execution and Caching</h3></div></div></div><p style="width:90%">
	When a Rivet page is requested, it is transformed into an
	ordinary Tcl script by parsing the file for the &lt;? ?&gt;
	processing instruction tags.  Everything outside these tags
	becomes a large <span style="font-family:monospace"><span><b class="command">puts</b></span></span> statement, and
	everything inside them remains Tcl code.
      </p><p style="width:90%">
	Each .rvt file is evaluated in its own
	<tt class="constant">::request</tt> namespace, so that it is not
	necessary to create and tear down interpreters after each
	page.  By running in its own namespace, though, each page will
	not run afoul of local variables created by other scripts,
	because they will be deleted automatically when the namespace
	goes away after Apache finishes handling the request.
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td colspan="2" align="left" valign="top">
	    One current problem with this system is that while
	    variables are garbage collected, file handles are not, so
	    that it is very important that Rivet script authors make
	    sure to close all the files they open.
      </td></tr></table></div><p style="width:90%">
      </p><p style="width:90%">
	After a script has been loaded and parsed into it's "pure Tcl"
	form, it is also cached, so that it may be used in the future
	without having to reload it (and re-parse it) from the disk.
	The number of scripts stored in memory is configurable.  This
	feature can significantly improve performance.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754823"></a>Debugging Rivet and Apache</h3></div></div></div><p style="width:90%">
	If you are interested in hacking on Rivet, you're welcome to
	contribute!  Invariably, when working with code, things go
	wrong, and it's necessary to do some debugging.  In a server
	environment like Apache, it can be a bit more difficult to
	find the right way to do this.  Here are some techniques to
	try.
      </p><p style="width:90%">
	The first thing you should know is that Apache can be launched
	as a <span class="emphasis"><em>single process</em></span> with the
	-X argument:</p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">httpd -X</pre>.
      <p style="width:90%">
	On Linux, one of the first things to try is the system call
	tracer, <span style="font-family:monospace"><span><b class="command">strace</b></span></span>.  You don't even have to
	recompile Rivet or Apache for this to work.
      </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">strace -o /tmp/outputfile -S 1000 httpd -X</pre><p style="width:90%">This command will run httpd in the system call tracer,
	which leaves its output (there is potentially a lot of it) in
	<tt class="filename">/tmp/outputfile</tt>.  The -S
	option tells <span style="font-family:monospace"><span><b class="command"></b></span></span>strace to only record the
	first 1000 bytes of a syscall.  Some calls such as
	<tt class="function">write</tt> can potentially be much longer than
	this, so you may want to increase this number.  The results
	are a list of all the system calls made by the program.  You
	want to look at the end, where the failure presumably occured,
	to see if you can find anything that looks like an error.  If
	you're not sure what to make of the results, you can always
	ask on the Rivet development mailing list.
      </p><p style="width:90%">
	If <span style="font-family:monospace"><span><b class="command">strace</b></span></span> (or its equivalent on your
	operating system) doesn't answer your question, it may be time
	to debug Apache and Rivet.  To do this, you will need to run
	the <span style="font-family:monospace"><span><b class="command">./configure.tcl</b></span></span> script with the
	-enable-symbols option, and recompile.
      </p><p style="width:90%">
	Since it's easier to debug a single process, we'll still run
	Apache in single process mode with -X:
      </p><pre style="background:#bbffbb ; width:90ex ; margin: 2ex ;      padding: 1ex; border: solid black 1px ; white-space: pre;      font-family:monospace ; " class="programlisting">
@ashland [~] $ gdb /usr/sbin/apache.dbg
GNU gdb 5.3-debian
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-linux"...
(gdb) run -X
Starting program: /usr/sbin/apache.dbg -X
[New Thread 16384 (LWP 13598)]
.
.
.
      </pre><p style="width:90%">
	When your apache session is up and running, you can request a
	web page with the browser, and see where things go wrong (if
	you are dealing with a crash, for instance).  A helpful
	<span style="font-family:monospace"><span><b class="command">gdb</b></span></span> tutorial is available here: <a href="http://www.delorie.com/gnu/docs/gdb/gdb_toc.html" target="_top">http://www.delorie.com/gnu/docs/gdb/gdb_toc.html</a>
      </p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="upgrading"></a>Upgrading from mod_dtcl or NeoWebScript</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="#id4754995">mod_dtcl</a></span></dt><dt><span class="section"><a href="#id4755008">NeoWebScript</a></span></dt></dl></div><p style="width:90%">
      Rivet is a break from the past, in that we, the authors, have
      attempted to take what we like best about our past efforts, and
      leave out or change things we no longer care for.  Backwards
      compatibility was not a primary goal when creating Rivet, but we
      do provide this information which may be of use to those wishing
      to upgrade from mod_dtcl or NWS installations.
    </p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4754995"></a>mod_dtcl</h3></div></div></div><p style="width:90%">
	Rivet was originally based on the dtcl code, but it has
	changed (improved!) quite a bit.  The concepts remain the
	same, but many of the commands have changed.
      </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id4755008"></a>NeoWebScript</h3></div></div></div><p style="width:90%">TODO</p></div></div></div></body></html>