File: icfaq.8

package info (click to toggle)
interchange-doc 4.8.3-1
  • links: PTS
  • area: main
  • in suites: sarge, woody
  • size: 17,396 kB
  • ctags: 4,509
  • sloc: makefile: 46
file content (1861 lines) | stat: -rw-r--r-- 71,231 bytes parent folder | download
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
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
.\" Automatically generated by Pod::Man version 1.02
.\" Wed Nov 28 14:08:01 2001
.\"
.\" Standard preamble:
.\" ======================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R

.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  | will give a
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used
.\" to do unbreakable dashes and therefore won't be available.  \*(C` and
.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` `
.    ds C' '
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr
.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
.\" index entries marked with X<> in POD.  Of course, you'll have to process
.\" the output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
.    .
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it
.\" makes way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.bd B 3
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ======================================================================
.\"
.IX Title "icfaq 8"
.TH icfaq 8 "Interchange 4.8.3" "2001-11-28" "Interchange"
.UC
.SH "NAME"
icfaq \- Frequently Asked Questions
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
.SH "How does Interchange work?"
.IX Header "How does Interchange work?"
.Sh "Where are the pages?"
.IX Subsection "Where are the pages?"
Interchange pages are not kept in normal \s-1HTML\s0 space. Look in the
catalog subdirectory pages. The pages are always filtered through the
Interchange daemon before being delivered.
.Sh "Where are the images?"
.IX Subsection "Where are the images?"
Interchange is a \s-1CGI\s0 program, and if relative image paths are used,
\&\s-1IMG\s0 tags like the following will occur:
.PP
<\s-1IMG\s0 SRC=\*(L"/cgi-bin/simple/../whatever.jpg\*(R">
.PP
Interchange, by default, uses an ImageDir for a prefix. In the
demo, image specs that have no absolute path information are prefixed
with /simple/images/.
.PP
In an Interchange page, this tag:
.PP
.Vb 1
\&       <IMG SRC="ordernow.gif">
.Ve
will become this:
.PP
.Vb 1
\&       <IMG SRC="/simple/images/ordernow.gif">
.Ve
This tag:
.PP
.Vb 1
\&       <IMG SRC="items/00-0011.jpg">
.Ve
will become this:
.PP
.Vb 1
\&       <IMG SRC="/simple/images/items/00-0011.jpg">
.Ve
Absolute image paths are not affected. An image such as
/other/images/whatever.gif will not be changed.
.SH "INSTALLATION"
.IX Header "INSTALLATION"
.Sh "Configuration Problems"
.IX Subsection "Configuration Problems"
Most Interchange configuration and setup problems are due to one of
the following:
.Ip "Wrong information given to makecat program." 4
.IX Item "Wrong information given to makecat program."
\&\fBThis is by far the most common problem.\fR To install a working demo,
Interchange needs to know what the DocumentRoot is and how to run
\&\s-1CGI\s0 programs. Details of this setup are server- and site-specific,
which may require some research.
.Sp
Re-run the configuration again, and pay close attention to the prompts
given. There are examples given which apply to most systems.
.Sp
If the web server is Apache or \s-1NCSA\s0, Interchange will try and parse
its httpd.conf file to help you along, but many ISPs don't allow
users to read these and it may fail.
.Ip "Too-low version of Perl." 4
.IX Item "Too-low version of Perl."
If you have a Perl earlier than 5.005, Interchange will not work.
Don't even try an earlier version.
.Ip "Perl compiled with \s-1USE_THREADS\s0." 4
.IX Item "Perl compiled with USE_THREADS."
Run perl \-V. If you see \-DUSE_THREADS in the compilation
definition, you might run into problems with Interchange.
.Sp
\&\fB\s-1NOTE\s0\fR: You cannot run the Interchange software as root.
.PP
If you are setting Interchange up for the entire machine, and not just
as a virtual host user, it is usual to create a special interch
user to run the daemon and the link program. This means the directory
listing for your cgi-bin should be something like:
.PP
.Vb 1
\& -rwsr-xr-x   1 interchange users        6312 Dec 30 11:39 cgi-bin/simple
.Ve
and for the socket file it should be:
.PP
.Vb 1
\& srw-------   1 interchange users           0 Dec 30 11:41 etc/socket
.Ve
Once you have set up the software, you can easily install catalogs as
root \fBas long as your umask is set to 2 or 22\fR.
.PP
(The following assumes you have made the Interchange software owned
and run by the special user interchange and that each user has a
Interchange catalogs directory /home/user/catalogs).
.PP
The best way to set permissions on a multi-user system is to make all
files group readable and writable (660 or 664 mode). If you have a
system setup that places each user in their own group, make
interchange a member of each user's group and set ownership and
permissions with:
.PP
.Vb 3
\&       find /home/user/catalogs -print | xargs chown user
\&       find /home/user/catalogs -print | xargs chgrp user
\&       find /home/user/catalogs -print | xargs chmod g+rw
.Ve
For best results, set the user's default umask to 2, so that they
will, by default, create files that have the proper permissions. If
you have all users in the same group, the above is not secure. You
should put interchange in a group of which no user is a member
(perhaps interchange would be a good choice) and set all files owned
by the group interchange and all directories to mode 2770:
.PP
This will make files default to the proper group when created (on most
\&\s-1UNIX\s0 versions, anyway).
.PP
.Vb 4
\&       find /home/user/catalogs -print | xargs chown user
\&       find /home/user/catalogs -print | xargs chgrp interchange
\&       find /home/user/catalogs -print | xargs chmod g+rw
\&       find /home/user/catalogs -type d -print | xargs chmod g+s
.Ve
If you are on a virtual hosting system, the procedure varies. Making
the program setuid should work for most systems. If your setup uses
\&\s-1CGI-WRAP\s0 or another setuid scheme, it should still work. However, you
may have to unset the setuid bit with chmod u-s cgi-bin/simple or
the like. If you have a non-standard \s-1CGI\s0 setup, as some virtual host
systems do, you will need to know something about \s-1UNIX\s0 and the web or
engage a consultant to properly set up the paths. Usually switching to
\&\s-1TLINK/INET\s0 mode is the easiest thing to do, though with Iserver and a
few others it may take more than that.
.PP
If you used the makecat program to build the catalog, it should
have warned you if it was not able to make the link program setuid. To
set the program (in the file cgi-bin/simple in this example) to be
setuid, use the command:
.PP
.Vb 1
\&   chmod u+s cgi-bin/simple
.Ve
.Sh "Error \*(-- the Interchange server was not running..."
.IX Subsection "Error  the Interchange server was not running..."
This indicates that the link \s-1CGI\s0 is not communicating with the
Interchange server. \fBImportant note:\fR The server should always be
started by the same user \s-1ID\s0 which owns the suid vlink program. (This
does not apply to \s-1TLINK/INET\s0 mode.)
.PP
The server must be running, first of all. If you didn't start it, you
can do so by going to the Interchange home directory and typing:
.PP
.Vb 1
\&   bin/interchange -restart
.Ve
You can check to see if your server is running by typing:
.PP
.Vb 2
\&   Linux, BSD:           ps -ax | grep interchange
\&   Most other systems:   ps -elf | grep interchange
.Ve
\&\fBNote: \fRSolaris and \s-1IRIX\s0 truncate the string, and don't allow setting
of the \f(CW$0\fR parameter. You may have to grep for 'perl' instead.
.PP
If the server is not running, it may have failed due to another
process occupying the \s-1TCP\s0 socket 7786. If using \s-1VLINK\s0, try starting
Interchange with start \-u, which will not monitor the
internet-domain socket.
.PP
If \s-1VLINK\s0 is not communicating with the server, there are a number of
possible reasons. First, if you are trying to run Interchange on an
\&\s-1ISP\s0, go to the section about \s-1ISP\s0 problems. It is probably one of
those. If you are running Interchange on a single machine, it is
probably one of:
.PP
.Vb 2
\&   1. Permissions problems
\&   2. Interchange on NFS-mounted file system
.Ve
Check the error_log file for your \s-1HTTP\s0 server \*(-- it will almost always
tell you what the problem is, unless there is a simple permissions
problem.
.PP
Permissions are easy. If starting Interchange like this works:
.PP
.Vb 1
\&        interchange -r SocketPerms=666
.Ve
then you have a socket permission problem. Try restarting interchange
without the above adjustment of SocketPerms=666, and then try
accessing it again with each of these mode changes:
.PP
.Vb 2
\&        chmod u+s cgi-bin/storename
\&        chmod u-s cgi-bin/storename
.Ve
.Vb 1
\&           cgi-bin/storename = path to your executable
.Ve
If neither of those work, either the \s-1UID\s0 the program is owned by is
wrong, or your \s-1HTTP\s0 server is interfering in some fashion. If you are
running Interchange on an NFS-mounted file system, it cannot run in
server mode because UNIX-domain sockets don't work on \s-1NFS\s0. You will
need to change to static mode from server mode, or better yet, put
Interchange on a file system that is directly mounted.
.PP
You can use Interchange in \s-1INET\s0 mode along with the tlink.c program to
allow running across \s-1NFS\s0 boundaries. If you have not changed the
configured defaults, and still it will not communicate, you should try
setting the \s-1LINK_HOST\s0 and \s-1LINK_PORT\s0 directives in tlink.c and
recompiling.
.Sh "I get messages like 'Config.pm not found.' What does it mean?"
.IX Subsection "I get messages like 'Config.pm not found.' What does it mean?"
This means your Perl is not properly installed, or that Interchange is
not using the proper Perl binary. On \s-1UNIX\s0, try reinstalling
Interchange and using the standard Perl installation sequence:
.PP
.Vb 4
\&   /complete/path/to/proper/perl Makefile.PL
\&   make
\&   make test
\&   make install
.Ve
Otherwise, contact your system administrator.
.Sh "Can't locate lib.pm in \f(CW@INC\fR. \s-1BEGIN\s0 failed\*(--compilation aborted."
.IX Subsection "Can't locate lib.pm in @INC. BEGIN failedcompilation aborted."
Again, your Perl is not properly installed. Someone has put a Perl up
on your system, then either moved or removed the library directory.
Contact your system administrator and request that Perl be
re-installed.
.Sh "Segmentation fault or other core dump."
.IX Subsection "Segmentation fault or other core dump."
If this happens when you run the Interchange test or server, it is
always Perl that has a problem. Not sometimes, always. A proper Perl
should never have a segmentation violation, period. And it should not
dump core (unless you passed it a \-u option somehow).
.PP
You will need to either update Perl or report the bug to the proper
personnel. Depending on your situation and technical ability, this may
be your system admin, \s-1ISP\s0, or the Perl porters.
.Sh "Configuring catalog whatever...Use of uninitialized value at Config.pm line 1614, <\s-1CONFIG\s0> chunk 322."
.IX Subsection "Configuring catalog whatever...Use of uninitialized value at Config.pm line 1614, <CONFIG> chunk 322."
This is a warning from Perl indicating that an empty value was found
where one is expected. The warning is left in so that you know that
something is missing. Whatever it is, it can be found at the specified
\&\*(L"chunk,\*(R" or line, of catalog.cfg. If you use the include capability,
it would have to be factored in as well.
.PP
The usual reason is that a file is specified in one of the directives
(usually one of Help, SearchProfile, OrderProfile, Buttonbars, or
UpsZoneFile) and does not exist. See the documentation for the
directive on how the file name should be specified.
.Sh "Why isn't the above error more enlightening?"
.IX Subsection "Why isn't the above error more enlightening?"
Because Perl won't tell us what exactly went wrong. See its \s-1FAQ\s0 for
why.
.Sh "\s-1XXXXXX\s0.pm does not match executable version."
.IX Subsection "XXXXXX.pm does not match executable version."
This is a Perl which does not have the right Perl library installed.
It usually results from a naive system administrator who thinks they
can bypass the 'make install' for Perl and just copy the Perl binary
or directories.
.PP
If you installed Bundle::Interchange locally in your Interchange
directory, it may mean that your system administrator updated Perl and
failed to select the binary compatibility option.
.Sh "Can I run Interchange on the Macintosh or Windows?"
.IX Subsection "Can I run Interchange on the Macintosh or Windows?"
Interchange will not run on a MacOS 7, 8, or 9 operating system. It
will run on Mac \s-1OS\s0 X and other PowerPC Unix variants.
.PP
Interchange's *files* can be manipulated by any computer. As long as
uploads/downloads of database source, pages, and configuration files
are done in \s-1ASCII\s0 mode, there is no reason why they can't be edited on
a Mac. And with MySQL or other \s-1ODBC\s0 databases on your UNIX-based \s-1ISP\s0,
you can even directly interface to the database you use with
Interchange provided you have the scarce \s-1ODBC\s0 middleware needed for
the Mac.
.PP
Interchange can be run on Windows with the Cygwin tool set (1.3.2 or
higher) available from Red Hat, but there are numerous anomalies and
it may be difficult to get operating reliably. It is never recommended
that you run a production catalog on a Windows system; if you do get
it working you should only use for catalog development.
.SH "SSL problems"
.IX Header "SSL problems"
.Sh "Shopping cart is dropped when using \s-1SSL\s0."
.IX Subsection "Shopping cart is dropped when using SSL."
If you are using a separate secure and non-secure domain, this is due
to the cookies from the user not matching as well as the session \s-1ID\s0
not being able to be transferred due to differing source \s-1IP\s0 addresses.
.Ip "" 4
\&\fB\s-1NOTE\s0\fR: Interchange does not support this configuration. You may be
able to get it to work in some circumstances, but it is not supported.
See the next set of questions for help on how you may be able to get
it to work to some extent in your configuration. It will not work in
every circumstance with every feature.
.PP
This is sometimes due to the HostnameLookups (Stronghold/Apache
parameter) not matching for the two servers, secure and non-secure. It
can also be caused by the user having different web proxy addresses
for \s-1HTTP\s0 and \s-1HTTPS\s0. If it still does not work, try changing some of
the appropriate configuration parameters in interchange.cfg:
.PP
.Vb 2
\&   DomainTail   No
\&   IpHead       Yes
.Ve
If you still are having problems, try this combination in catalog.cfg,
the catalog configuration file:
.PP
.Vb 2
\&   SessionExpire  10 minutes
\&   WideOpen       Yes
.Ve
The above setting will typically make Interchange work when it is
possible to work. Sometimes when you have multiple Interchange servers
sharing the same secure server, you will have problems after accessing
the second one. (The first one issues a session \s-1ID\s0 cookie, and that
causes problems).
.Sh "I have a different secure server domain. Why does the shopping cart get dropped?"
.IX Subsection "I have a different secure server domain. Why does the shopping cart get dropped?"
First of all, it is questionable business practice to not certify your
secure server. Besides violating the terms of use of many certificate
issuers, customers notice the changed domain and it is proven by user
surveys and long experience that you will receive fewer orders as a
result. Certs can be obtained for \f(CW$125\fR \s-1US\s0 per year, less than the
typical cost of one hour of a top consultant's time. Do your business
a favor \*(-- spend the money to get a cert.
.PP
If you insist on doing it anyway, probably driven by the fact that you
need a dedicated \s-1IP\s0 address for a secure server, you can use the
solutions in the previous \s-1FAQ\s0 question and get some relief.
.PP
But by far the best way is to have all orders and shopping cart calls
go only to the secure domain.  Your users may get a different session
when browsing the non-secure catalog pages, but it will matter little.
.PP
To do this on the Foundation demo, place in catalog.cfg:
.PP
AlwaysSecure  order ord/basket ord/checkout
.PP
A more complete list might be:
.PP
.Vb 18
\& AlwaysSecure <<EOF
\&         account
\&         change_password
\&         customerservice
\&         login
\&         logout
\&         new_account
\&         ord/basket
\&         ord/checkout
\&         order
\&         process
\&         query/check_orders
\&         query/order_detail
\&         query/order_return
\&         returns
\&         saved_carts
\&         ship_addresses
\&EOF
.Ve
Add pages of your own that need to be sure of coherent session
information.
.PP
For all *forms* to be secure, make sure \*(L"process\*(R" is on that list.
(Your search forms will still be non-secure if you use
\&\*(L"[process-search]\*(R" to produce the form \s-1ACTION\s0.)
.PP
To make individual order links secure, use this instead of \*(L"[order]\*(R":
.PP
<A HREF=\*(L"[area href=order secure=1 form='mv_order_item=SKU_OF_ITEM'
]\*(R">Order it</A>
.PP
To make a form-based order button secure, use \*(L"[process secure=1]\*(R" as
the \s-1ACTION\s0.
.Sh "My images aren't there on the secure server!!!"
.IX Subsection "My images aren't there on the secure server!!!"
You have a different document root, or the permissions are not such
that you can access them. You can set a different base \s-1URL\s0 for images
with:
.PP
.Vb 1
\&        ImageDirSecure   https://your.secure.server/somewhere/images
.Ve
Don't try to set it to an http:// \s-1URL\s0 \*(-- images will be broken anyway.
.Sh "My secure pages fail when the browser is \s-1MSIE\s0."
.IX Subsection "My secure pages fail when the browser is MSIE."
\&\s-1MSIE\s0 has several \s-1SSL\s0 bugs, particularly in V5.01.  See the
Apache-SSL or mod_ssl \s-1FAQ\s0. You can sometimes fix this with an
httpd.conf change:
.PP
SetEnvIf User-Agent \*(L".*MSIE.*\*(R" nokeepalive ssl-unclean-shutdown
.SH "ISP Problems"
.IX Header "ISP Problems"
The great majority of ISPs provide some \s-1CGI\s0 service, and more and more
run systems that are compatible with Interchange. The new catalog
configurator for Interchange makes setup much easier. A word of
warning: if you chose your \s-1ISP\s0 mostly on price, you can expect
problems. The low-cost providers typically have heavily-loaded
machines and many domains. The more domains and the more load the
unhappier you will be with Interchange. Interchange works best on a
fast machine with plenty of memory.
.PP
A few Internet Service Provider (\s-1ISP\s0) systems still have difficulty
with one or the other aspect of running Interchange. A few cannot (or
will not) run Interchange at all. On top of that, many times \s-1ISP\s0
personnel are too busy to help, won't help, or don't know enough to
help. Some are secretive about details of the setup of their systems.
.PP
All in all, you can have a fair amount of confidence that your \s-1ISP\s0 can
run Interchange. Or, you can get one who will. 8\-)
.Sh "No shell access allowed on my \s-1ISP\s0."
.IX Subsection "No shell access allowed on my ISP."
Generally it is a waste of time to try to use Interchange without
shell access.
.Sh "We're sorry, the Interchange server is unavailable..."
.IX Subsection "We're sorry, the Interchange server is unavailable..."
(The following assumes that you were able to start the Interchange
server.)
.PP
This could be almost anything, but with a properly configured
Interchange it is almost undoubtedly due to your cgi-bin and/or your
Interchange directory being located on a different filesystem than the
actua machine that is executing the program. \s-1VLINK\s0 uses UNIX-domain
sockets, which don't work on NFS-mounted filesystems.
.PP
Iserver.com and other systems which use chroot \s-1HTTP\s0 servers require
quite a bit of extra configuration to get going. If you have not been
careful to set permissions properly when running in \s-1VLINK/UNIX\s0 mode,
the link \s-1CGI\s0 will not be able to communicate with the Interchange
server. Please read the documentation that covers this in detail.
.PP
You can run in \s-1INET\s0 mode with the tlink link program to prevent
those problems.
.Sh "Document contains no data or premature end of script headers (especially on \s-1BSDI\s0 or FreeBSD)."
.IX Subsection "Document contains no data or premature end of script headers (especially on BSDI or FreeBSD)."
This usually means that your \s-1HTTP\s0 server ran out of resources during
the execution of the link program. It couldn't create more sockets, is
unable to create a process, or can't open any more files.
.PP
This usually happens in frames catalogs, when Interchange is sending
more than one page simultaneously. And even more especially on FreeBSD
and \s-1BSDI\s0, which are often distributed with the kernel parameters
\&\s-1SOMAXCONN\s0 and \s-1CHILD_MAX\s0 set to levels unsuitable for serving the web.
.PP
Go to <http://www.deja.com> and try searching for \s-1MAXUSERS\s0. This
should give you plenty of pointers on how to set these parameters
properly.
.Sh "Interchange server only runs for a while, then dies."
.IX Subsection "Interchange server only runs for a while, then dies."
Many ISPs don't allow your user \s-1ID\s0 to run a program unless it is
logged in! The moment a watchdog program notices a daemon running with
a non-logged-in \s-1UID\s0, it terminates the program. Or, it terminates
programs that haven't been active for \s-1XX\s0 minutes. Contact your \s-1ISP\s0
about this. They may be able to do something for you.
.Sh "My entire home directory is in \s-1HTML\s0 document space."
.IX Subsection "My entire home directory is in HTML document space."
If working with an \s-1ISP\s0 where all of the files are in \s-1HTML\s0 document
space, disable all access to the Interchange catalog directory with
the proper \s-1HTTP\s0 access restrictions. Normally that is done by creating
a .htaccess file like this:
.PP
.Vb 4
\&        <Limit GET POST>
\&        order allow,deny
\&        deny from all
\&        </Limit>
.Ve
If unable to do this, do not run Interchange unless file permissions
can be set such that files will not be served. However, security will
be a problem and customers' personal information could be placed at
risk.
.SH "SYSTEM CONFIGURATION"
.IX Header "SYSTEM CONFIGURATION"
.Sh "Can I run multiple catalogs on one server?"
.IX Subsection "Can I run multiple catalogs on one server?"
Yes. Interchange supports multiple independent catalogs. There are
users who run more than 500 catalogs on a single machine. The capacity
is usually a function of how busy the catalogs are and how much memory
and processor speed your system has.
.Sh "How do I start Interchange when I reboot?"
.IX Subsection "How do I start Interchange when I reboot?"
Use the standard facility on your operating system. For BSD-style
systems, the file is usually called rc.local (in the /etc directory).
.PP
On \s-1SVR4\s0 systems, it is quite a bit more complex. Look for the
/etc/rc.d directory and see what other programs do. Often the file is
called S99startup or something similar.
.PP
\&\fBImportant note:\fR Interchange must not run as root, which is the user
identity that the startup file executes. (Interchange will refuse to
start if executed as root.) The technique to start up depends on the
facility of your \fIsu\fR\|(1) command. This should work on most operating
systems:
.PP
.Vb 3
\&   su interchange <<EOF
\&   /your/interchange/dir/bin/restart
\&   EOF
.Ve
The \fB\s-1EOF\s0\fR must be the only thing on the line (no leading or trailing
whitespace). If your \fIsu\fR\|(1) command has a \-c option (as most System
5 UNIXes do), you can just set:
.PP
.Vb 1
\&   su -c /your/interchange/dir/bin/restart interchange
.Ve
Interchange supplies a restart script which tries to do the above
portably. It works on many operating systems.
.Sh "I installed the Interchange \s-1RPM\s0, and I can't restart."
.IX Subsection "I installed the Interchange RPM, and I can't restart."
This usually means that you tried to run
/usr/lib/interchange/bin/interchange, which fails to take into account
the Linux Standard Base (\s-1LSB\s0) file setup. Instead, run
.PP
/etc/rc.d/init.d/interchange restart
.PP
or
.PP
/usr/sbin/interchange \-r
.Sh "How do I set up a mall?"
.IX Subsection "How do I set up a mall?"
Interchange can share product databases, session files, and any other
databases. It has many features which support mall building. You can
easily build separate and mostly identical catalogs which you link to
via \s-1HTML\s0. But building a mall is as much an exercise in data and
process as in software. Consider the following questions:
.Ip "1." 4
Who will be clearing payment?
.Ip "2." 4
What happens if everyone doesn't have the same tax rate?
.Ip "3." 4
How will you clear orders to multiple vendors?
.Ip "4." 4
How will you bring together multiple types of shipping?
.Ip "5." 4
How will the vendors get product data (including images) to you?
.PP
If you cannot answer those questions and visualize how to build a
mall, you probably should not try.
.SH "PRODUCT OPTIONS"
.IX Header "PRODUCT OPTIONS"
.Sh "Can I attach a size or color to a product?"
.IX Subsection "Can I attach a size or color to a product?"
Interchange has product modifiers, or attributes, which can be carried
around with the product. Inside an item list or the product page
(flypage), the [item-options] tag will automatically place suitable
widgets on an \s-1HTML\s0 form, and \*(L"remember\*(R" what should be selected. See
the Interchange documentation for \fBItem Options\fR.
.PP
You can use the SeparateItems directive or set the
mv_separate_items variable on the order form to cause ordered items
to be put on separate lines in the shopping basket. (This is the
default in the demo catalogs.)
.Sh "Can I change the price based on size or color (or other attribute)?"
.IX Subsection "Can I change the price based on size or color (or other attribute)?"
Yes. Use the Interchange \s-1UI\s0 to set up your product options. It
operates on the options database table to set up options that can
effect price. Or see the next question.
.Sh "How are simple product options structured?"
.IX Subsection "How are simple product options structured?"
Interchange has three types of options; \fIsimple\fR, \fImatrix\fR, and
\&\fImodular\fR. They are based on the options database table.
.PP
To enable options for a product, it needs to have a master record in
\&\*(L"options\*(R" with the \s-1SKU\s0 as the key. The only fields that matter in the
master record are:
.PP
.Vb 1
\& code        The SKU of the item
.Ve
o_master    Indicates not a product, but an option for a product in another database
.PP
o_enable    Options enabled for that item
.PP
o_matrix    Set to 1 for all-in-one widgets, 2 for separate widgets
.PP
o_modular   Modular options (alpha)
.PP
If o_enable is set, but neither o_matrix or o_modular are, the item is
using simple options.
.PP
For the option itself in simple mode, the following fields apply:
.PP
.Vb 9
\& code        Arbitrary key
\&sku         SKU this option applies to
\&o_group     The attribute name of the option
\&o_label     The label the widget for the option will bear
\&o_value     The options, in IC option format
\&o_widget    The widget type used to display
\&o_height    The widget height (if any)
\&o_width     The widget width (if any)
\&price       Price adjustment
.Ve
Here are the fields for an item with a simple size option:
.PP
.Vb 16
\& code:os28009
\&o_master:1
\&o_enable:1
\&o_matrix:0
\&o_modular:0
\&#
\&code:os28009-size
\&sku:os28009
\&o_group:size
\&o_label:Size
\&o_value:S=Small,M=Medium,L=Large,XL=Extra Large
\&o_widget:select
\&o_height:
\&o_width:
\&price:S=-1.00,XL=1.00
\&#
.Ve
The price field accepts option modifiers based on the option value;
for example, to adjust the price of an S down 1.00 and the price of an
\&\s-1XL\s0 up 1.00, you use the values shown above. This works in conjunction
with the special ==:options atom in CommonAdjust. To activate the
pricing adjustment, you must have something like this for your
CommonAdjust setting:
.PP
.Vb 1
\& CommonAdjust    :sale_price, ;:price, ==:options
.Ve
The actual names of the fields used for these can be changed with the
Variable \s-1MV_OPTION_TABLE_MAP\s0, i.e.
.PP
.Vb 4
\& Variable MV_OPTION_TABLE_MAP <<EOM
\&        o_widget  widget
\&        o_value   value
\&EOM
.Ve
That would allow you to use \*(L"widget\*(R" and \*(L"value\*(R" in place of o_widget
and o_value as field names.
.Sh "But what do these options do? Where do they live?"
.IX Subsection "But what do these options do? Where do they live?"
If you know Perl, you know what a hash reference is. An Interchange
shopping cart consists of an \fIarray of hash references\fR. If you dump
the structure of the main shopping cart you would see something
like:
.PP
.Vb 18
\&        [
\&                {
\&                        mv_ip       => '0',
\&                        price_group => 'general',
\&                        mv_ib       => 'products',
\&                        code        => 'os28080',
\&                        quantity    => '1',
\&                },
\&                {
\&                        mv_ip       => '1',
\&                        price_group => 'general',
\&                        mv_ib       => 'products',
\&                        code        => 'os28080',
\&                        size        => 'L',
\&                        color       => 'black',
\&                        quantity    => '1',
\&                },
\&         ]
.Ve
Each key of the hash is an attribute. There are a number of special
attributes:
.PP
code	       The item \s-1SKU\s0 sku 	       The \s-1SKU\s0 of the base item (in the
case of matrix options) mv_ip	       The line number of the shopping
cart (minus 1) mv_ib	       The database table the product was ordered
from quantity       The number on order group          The order group
for a master item or subitem mv_si          Subitem indicator mv_mi   
      Master item code mv_mp          Modular item mv_price      
Price of the item (to directly set pricing) mv_order_route Special
order route for this item
.PP
Any attribute besides the above is a product \fIoption\fR or \fImodifier\fR,
and can be displayed with [item-modifier attribute_name].
.SH "ENCRYPTION"
.IX Header "ENCRYPTION"
.Sh "\s-1PGP\s0 encryption \*(-- Server Error"
.IX Subsection "PGP encryption  Server Error"
As always, check the error log. The most common problem is something
like:
.PP
.Vb 3
\&   akopia.com 3Ex5lvta:akopia.com - [01/Sep/1997:09:08:43] simple /cgi-bin/simple
\&   > Encryption error:
\&   >
.Ve
Also, check the ScratchDir (usually tmp/) for .err files; they
will contain \s-1PGP\s0 or \s-1GPG\s0's error output.
.PP
Probable causes:
.Ip "Interchange user \s-1ID\s0 doesn't have keyring" 4
.IX Item "Interchange user ID doesn't have keyring"
You must have a .pgp or .gnupg directory in the home directory
of the user running Interchange. It is also possible to set an
environment variable (variously \s-1PGPPATH\s0 or \s-1GNUPGPATH\s0) to orient the
program correctly.
.Ip "EncryptProgram directive set wrong" 4
.IX Item "EncryptProgram directive set wrong"
In Interchange 4.7.7 and above, you only need specify \*(L"gpg\*(R", \*(L"pgp\*(R", or
\&\*(L"pgpe\*(R". The key is set in EncryptKey. If you don't set a value for
EncryptProgram, Interchange will look for gpg first, then pgpe,
then finally pgp, using the first it finds. If it can't find one of
those, it is set to none and encryption can't be done. You can specify
a full path to the program in the directive, but no arguments need be
set. \s-1NOTE:\s0 old values in EncryptProgram will still work, just are not
needed.
.Sh "\s-1PGP\s0 encryption \*(-- What do I do now that it is working?"
.IX Subsection "PGP encryption  What do I do now that it is working?"
This depends on what you do with orders once you receive them by
email. Some \s-1PC\s0 mail agents (notably Eudora) will decrypt the \s-1PGP\s0
message embedded within the message text. In that case, you can simply
embed the [value mv_credit_card_info] call right in the message and
be done with it.
.PP
If your mailer will not decrypt on the fly, the best way to read the
credit card number is to set up \s-1MIME\s0 encoding of the order email. To
do this, find the order report you are using. In the standard demos it
is pages/ord/report.html or etc/report.
.PP
Set up two \s-1MIME\s0 regions in that file. First, at the top of the file:
.PP
.Vb 2
\&   [tag mime type TEXT/PLAIN; CHARSET=US-ASCII][/tag]
\&   [tag mime Order Text]
.Ve
.Vb 2
\&   ORDER DATE: [calc]localtime[/calc]
\&   ORDER NUMBER: [value mv_order_number]
.Ve
.Vb 2
\&   Name: [value name]
\&   Company: [value company]
.Ve
.Vb 2
\&   (Rest of order text, including item list)
\&   [/tag]
.Ve
Then, at the bottom of the report.html file, put the credit card info:
.PP
.Vb 3
\&   [if value mv_credit_card_info]
\&   [tag mime type application/pgp-encrypted][/tag]
\&   [tag mime Credit Card Information]
.Ve
.Vb 1
\&   [value mv_credit_card_info]
.Ve
.Vb 2
\&   [/tag]
\&   [/if]
.Ve
Once this is done, you can read mail using your \s-1PGP\s0 client as a helper
application to decode the \s-1MIME\s0 attachment. This does not require a
fancy setup \*(-- you can use the standard \s-1MIT\s0 \s-1PGP\s0 2.6.2 if desired. If
you are using \s-1UNIX\s0, set up as the helper for the \s-1MIME\s0 type
\&\fBapplication/pgp-encrypted\fR:
.PP
.Vb 1
\&   xterm -e pgp -m %s
.Ve
More automated or user-friendly setups are left as an exercise for the
user.
.SH "How do I...."
.IX Header "How do I...."
.Sh "How do I get the number of items in a shopping cart?"
.IX Subsection "How do I get the number of items in a shopping cart?"
If it is simply the total number, extended according to quantity, you
can use the [nitems] tag. If you need this number for use in an
embedded Perl script, you can use:
.PP
.Vb 1
\&   $number = $Tag->nitems();
.Ve
If it is the number of line items you need, then you can use a Perl
script:
.PP
.Vb 3
\&   [perl]
\&       return scalar @{$Carts->{main}};
\&   [/perl]
.Ve
(The 'main' refers to the main shopping cart.)
.PP
If you have SeparateItems in effect, and need the number of unique
items, you could use:
.PP
.Vb 10
\&   [perl]
\&       my $cart = $Carts->{main};
\&       foreach my $item (@$cart) {
\&   @items = split /\e|/, $items;
\&   $count = 0;
\&   for (@items) {
\&   $count++ unless $seen{$_}++;
\&   }
\&   $count;
\&   [/perl]
.Ve
.Sh "The demo doesn't do ... (pick one)"
.IX Subsection "The demo doesn't do ... (pick one)"
That is because it is a demo. It is not intended to be a finished
catalog, just a starting point.
.Sh "How can I trace the source of a purchase and run a partners program?"
.IX Subsection "How can I trace the source of a purchase and run a partners program?"
Interchange has a facility that adds a parameter called \fIsource\fR to
the session database for that user. You should give your partners a
source code, which must contain at least one letter character (A-Za-z
only). It is placed in the sourcing \s-1URL\s0 as a query string of:
.PP
.Vb 1
\&   mv_pc=Source1
.Ve
If this is appended to the \s-1URL\s0 with which the user calls Interchange,
it will then be placed in the session identifier source.
.PP
This \s-1URL:\s0
.PP
.Vb 2
\&   <A HREF="http://yourcatalog.com/cgi-in/yourcat/sp_offer?mv_pc=Source1">
\&       Special offer!&lt;/A>
.Ve
will yield Source1 from the Interchange tag [data session source].
.PP
The Interchange 3 idiom ?;;Source1 continues to be supported, so
existing partner sites should work without change.
.Sh "How can I send an email copy of the receipt to a user?"
.IX Subsection "How can I send an email copy of the receipt to a user?"
There are several ways, but this is a more complex question than it
may seem like it is. You will have to deal with bad email addresses,
deciding which information to send, showing delivery times, etc. You
also have to be very careful with credit card information. If you have
not taken the proper security measures (by enabling \s-1PGP\s0 credit card
encryption or using CyberCash), you might just mail them their own
unencrypted credit card number!
.PP
This is supported in Interchange via a UserTag, [email ...]. See the
\&\*(L"simple\*(R" and \*(L"basic\*(R" demos.
.Sh "How do I display Euro pricing?"
.IX Subsection "How do I display Euro pricing?"
You can use Interchange's \s-1II8N\s0 facilty via the Locale directive. In
catalog.cfg:
.PP
.Vb 7
\& # to define the euro-Settings (PriceDivide is for converting from DM)
\&Locale eur_EUR PriceDivide         1.95583
\&Locale eur_EUR p_cs_precedes       0
\&# this is great - you can even use HTML-Tags to display an euro-image
\&Locale eur_EUR currency_symbol     "<IMG src="/path/to/image/euro.gif">"
\&Locale eur_EUR p_sep_by_space      2
\&Locale eur_EUR mon_decimal_point   ,
.Ve
# and the \s-1DM\s0
Locale de_DE
Locale de_DE p_cs_precedes  0
Locale de_DE p_sep_by_space 2
.PP
\&\fBNote: \fRBe sure to use the latest exchange rates when you establish
your catalog.
.PP
On your pages (this is from a search results page, the [item-.... ...]
notation may be different depending on your context):
.PP
.Vb 4
\& [item-price]<br><!-- german is default -->
\&[setlocale eur_EUR]
\&  [currency convert=1][item-field price][/currency]<br><!-- the euro -->
\&[setlocale]
.Ve
Any questions? Read the docs about \*(L"Internationalization.\*(R"
.SH "Errors"
.IX Header "Errors"
.Sh "Sorting doesn't work across multiple pages."
.IX Subsection "Sorting doesn't work across multiple pages."
If you are using the [sort table:field] idiom, it cannot. It sorts
data present in the list only.
.Sh "I am searching for a string and it is not found. I know it is there!"
.IX Subsection "I am searching for a string and it is not found. I know it is there!"
Set mv_substring_match to yes (su=yes in one-clicks). This
most commonly happens when searching for non-ISO-8859 (Cyrillic, or
characters like umlaut and eacute) characters in word-match mode. The
problem is, that unless your locale is set up properly, Perl doesn't
think a non-ISO-8859 and a space character is a boundary.
.PP
Also, if you are searching for non-alpha characters, they will also
not be interpreted as word characters and the boundary problems will
still exist.
.SH "Performance Issues"
.IX Header "Performance Issues"
Interchange is not a lightweight program. If you are running it on a
low-end \s-1ISP\s0, whose major selling point is low cost, you will
frequently find that Interchange performance is very poor. This is due
to either:
.Ip "Not enough memory" 4
.IX Item "Not enough memory"
If memory is low, the program will \*(L"swap\*(R" to disk. If lots of swap is
used, you can expect very bad performance. This is the most common
speed problem.
.Sp
If your \s-1ISP\s0 uses \s-1IDE\s0 hard disks, you can expect \s-1REALLY\s0 bad
performance. \s-1IDE\s0 disks are very slow for multi-user machines, which
should have \s-1SCSI\s0 if \s-1ANY\s0 swapping is to be done.
.Ip "Too many domains" 4
.IX Item "Too many domains"
If there is a huge amount of traffic on the system, then it can run at
a very high \*(L"load average.\*(R" If the machine's load average is routinely
above 2, you can expect problems.
.Ip "Underpowered machine" 4
.IX Item "Underpowered machine"
If it is an old machine, it may be too slow for Interchange. A Pentium
of less than 300MHz is probably not good enough unless it is
completely dedicated to Interchange. The faster the processor, the
happier you will be.
.Sh "Interchange runs, but it's sooo sllooowww..."
.IX Subsection "Interchange runs, but it's sooo sllooowww..."
This is almost certainly due to a system that has inadequate memory or
network bandwidth. On a moderately fast \s-1ISP\s0 server with sufficient
memory, pages should start displaying in less than 2 seconds. On a
fast server, pages should start loading almost instantaneously.
.Sh "Interchange slows down over time."
.IX Subsection "Interchange slows down over time."
There are many possible reasons for this, but most have to do with
memory or session database size.
.Ip "\(bu" 4
See the documentation on Interchange administration (icadmin) and
learn how to expire your session database. If it is megabytes in size,
accessing a key will significantly slow down the session.
.Ip "\(bu" 4
Second, if your machine is memory-poor, you will find that Interchange
gets swapped to disk. Unless your system is very fast, this will
greatly hurt performance. Interchange works best on a machine that
rarely if ever swaps to disk.
.Ip "\(bu" 4
Third, this often has nothing to do with Interchange at all but has to
do with your \s-1HTTP\s0 server. Any long-running daemon has the potential
for a memory leak. Try stopping and starting your \s-1HTTP\s0 server and
seeing what happens to performance.
.Sh "I am using \s-1SQL\s0, and Interchange is slow ..."
.IX Subsection "I am using SQL, and Interchange is slow ..."
It isn't Interchange. First of all, did you index your '\s-1SKU\s0' or other
key fields? The reason Interchange doesn't do it for you is that every
\&\s-1SQL\s0 database seems to do that a bit differently. Even then, you can
try Interchange's \s-1COLUMN_DEF\s0 parameter:
.PP
Database  products  \s-1COLUMN_DEF\s0  code=char(16) \s-1PRIMARY\s0 \s-1KEY\s0
.PP
This will at least index the code field for MySQL. Other databases
differ.
.PP
Interchange can return \s-1VERY\s0 fast \s-1SQL\s0 search results. But you need to
at least give it something to work with. The proper method for fast
selection is:
.PP
.Vb 1
\& [query sql="select code,category,title,price from products" ]
.Ve
Category: [sql-param category]<\s-1BR\s0>
Title:    <A HREF=\*(L"[area [sql-code]]\*(R"> [sql-param title] </A><\s-1BR\s0>
Price:    <A HREF=\*(L"[area order [sql-param 0]]\*(R"> [sql-param price] </A><\s-1BR\s0>
.PP
[/sql]
.PP
This is especially powerful when you consider a joined query like:
.PP
.Vb 3
\&       SELECT code, price, title, extended.desc
\&       FROM   products, extended
\&       WHERE  products.category = 'Renaissance'
.Ve
Note that the extended.desc field will be accessed as [sql-param
desc]. Don't forget that you must index your fields if you want fast
searching with them as a criteria.
.SH "Using Interchange with Apache and SUEXEC"
.IX Header "Using Interchange with Apache and SUEXEC"
Apache with \s-1SUEXEC:\s0 \s-1VLINK/UNIX\s0 socket mode will not work well unless
installed as a normal user. If supporting multiple users, the
\&\s-1TLINK/INET\s0 mode must be used.
.SH "A friendly reminder"
.IX Header "A friendly reminder"
\&\fBWhen in doubt, restart the server.\fR It won't take but a few seconds,
and changes in configurable options don't take effect until it is
done. You may even change a page and not see the effect until the
server is restarted.
.SH "Tips and tricks"
.IX Header "Tips and tricks"
These are slightly edited postings to the Interchange-users mail list
made by Mike Heins, lead author of Interchange.
.Sh "Locking down your system"
.IX Subsection "Locking down your system"
Interchange has lots of built-in protections to make developing your
catalogs pretty care-free. But it will definitely pass you the ammo to
shoot yourself in the foot, as will any templating system that has
power. So you have to be careful, as you do in any scripting
environment.
.PP
Most of the protections have to do with:
.Ip "6." 4
Tags like [cgi foo], [data ...] and such are not reparsed for tags.
.Ip "7." 4
The [value foo] tag never allows a left square bracket to be output.
.Ip "8." 4
Safe is used for Perl, which means that arbitrary perl code which
reads/writes or uses \s-1IO\s0 is not possible.
.Ip "9." 4
The Interchange files don't need to be readable or writable by any
other user \s-1ID\s0, so \s-1CGI/PHP\s0 programs run by the web server can't get at
them.
.Ip "10." 4
.IX Item "10."
Dangerous operations are allowed only via global UserTag, and not by
catalog UserTag.
.PP
But there are ways that user-entered data could end up getting parsed
for tags. The most common breach is to take possibly tainted user data
entered into a form and put it in a database without filtering it
first. There are several ways to do that:
.Ip "\(bu" 4
For user-entered form fields like name, address, etc you should always
use the [value ...] tag to display them.
.Ip "\(bu" 4
You can filter lists of variables automatically with
.Sp
.Vb 4
\&    Filter  name     textarea_put
\&    Filter  address  textarea_put
\&    Filter  comments textarea_put
\&    Filter  email    textarea_put
.Ve
in catalog.cfg.
.Ip "\(bu" 4
You can prevent problems in some cases by using the data tag (i.e.
[data table=foo col=bar key=\*(L"[item-param something]\*(R"]) which is not
reparsed for tags as [item-data ....] is. This is not foolproof unless
you control the key in some fashion \*(-- in most cases, you will use
[data session username] or something you control.
.Ip "\(bu" 4
You should never put user-entered data directly in a Scratch variable,
which can be called with mv_click and mv_check.
.Ip "\(bu" 4
Process all user-entered data before putting it in a database that
could be displayed in a page later. Or process it before it is
displayed.
.Ip "\(bu" 4
When putting data inside a container tag, the output of which is
reparsed for more tags by default, consider setting reparse=0.
.PP
There are other ways to nail down your system and make it more
difficult to have a security problem.
.Ip "\(bu" 4
Use the \s-1WRITE_CONTROL\s0 database settings.
.Sp
.Vb 1
\&  Database products WRITE_CONTROL 1
.Ve
It is the default for \s-1MV\s0 \s-1DBM\s0 databases (i.e. you have to have a [flag
type=write table=foo] to write) but not for \s-1SQL\s0.
.Sp
The \s-1UI\s0 does the proper write flagging, so this should have no effect
on it.
.Sp
\&\s-1AUTHORS\s0 \s-1NOTE:\s0 I should have made \s-1WRITE_CONTROL\s0 the default for \s-1SQL\s0 in
\&\s-1MV4\s0, my bad. As long as \s-1MV3\s0 compatibility was as poor as it turned out
to be, I should have gone for it.
.Ip "\(bu" 4
Set \*(L"NoAbsolute Yes\*(R" in interchange.cfg, it prevents [file /some/dir]
or [include /some/rogue/file] from being used. \s-1NOTE:\s0 This is the
default starting in \s-1IC\s0 4.7.x.
.Ip "\(bu" 4
Split the admin server onto a different \s-1IC\s0 iteration from your
production catalog, and disable the \s-1UI\s0 for the production catalog.
That allows you to set the pages/ directory to be read-only for the
production server, and to put \s-1WRITE_CONTROL\s0 in the production
catalog_after.cfg or etc/<catalog id>.after file.
.Sp
You could also use a different username to access the \s-1SQL\s0 data, and
make the production server username have read-only access.
.Sp
You can use a different \s-1UID\s0 for the admin server iteration, and make
all directories except products/, upload/, tmp/, session/, and logs/
read-only for the production server \s-1UID\s0.
.Ip "\(bu" 4
Make as much stuff read-only as you can. Develop a script which sets
things read-write while you are admin-ing, and read-only otherwise.
.Ip "\(bu" 4
Always make ICDIR/*.cfg, ICDIR/bin/*, and ICDIR/lib/* read-only for
the \s-1IC\s0 user.
.Ip "\(bu" 4
Don't let the interchange daemon user \s-1ID\s0 have read or write permission
on things it doesn't need.
.Ip "\(bu" 4
Never use AllowGlobal in production if you have user-entered data
going into a database. (AllowGlobal is not the default, so many people
won't know what it is \*(-- see Interchange Configuration.)
.PP
All in all, Interchange has been proven to be securable over time. But
we all have to do our part and think about what we are doing with
user-entered data.
.Sh "Optimizing lists"
.IX Subsection "Optimizing lists"
Interchange has powerful search capabilities that allow you to produce
lists of items for use in category lists, product lists, indexes, and
other navigation tools.
.PP
These are a two-edged sword, though. Lists of hundreds or thousands of
entries can be returned, and techniques that work well displaying only
a few items may slow to a crawl when a large list is returned.
.PP
In general, when you are returning one item (i.e. a flypage) or a
small list (i.e. a shopping cart) you can be pretty carefree in your
use of [if ...] and [calc] and [perl] tags. When there are hundreds of
items, though, you cannot; each complex test or embedded Perl snippet
causes the Safe module to have to evaluate code, and each \s-1ITL\s0 tag
requires parsing and argument building.
.PP
The Safe module is pretty fast considering what it does, but it can
only generate a few thousand instances per second even on a fast
system. And the \s-1ITL\s0 tag parser can likewise only parse thousands of
tags per \s-1CPU\s0 second.
.PP
What to do? You want to provide complex conditional tests but you
don't want your system to slow to a crawl. Luckily, there are
techniques which can speed up complex lists by orders of magnitude.
.PP
Benchmarking
.PP
A non-precise benchmark of different iteration options can be done
with the following global UserTag. Place this in a file in the
usertag/ directory in the Interchange root:
.PP
.Vb 32
\& UserTag benchmark Order start display
\&UserTag benchmark AddAttr
\&UserTag benchmark Routine <<EOR
\&my $bench_start;
\&my @bench_times;
\&sub {
\&    my ($start, $display, $opt) = @_;
\&    my @times = times();
\&    if($start or ! defined $bench_start) {
\&        $bench_start = 0;
\&        @bench_times = @times;
\&        for(@bench_times) {
\&            $bench_start += $_;
\&        }
\&    }
\&    my $current_total;
\&    if($display or ! $start) {
\&        for(@times) {
\&            $current_total += $_;
\&        }
\&        unless ($start) {
\&            $current_total = sprintf '%.3f', $current_total - $bench_start;
\&            for(my $i = 0; $i < 4; $i++) {
\&                $times[$i] = sprintf '%.3f', $times[$i] - $bench_times[$i];
\&            }
\&        }
\&        return $current_total if ! $opt->{verbose};
\&        return "total=$current_total user=$times[0] sys=$times[1] cuser=$times[2] csys=$times[3]";
\&    }
\&    return;
\&}
\&EOR
.Ve
Then at the beginning of the code to check, call
.PP
.Vb 1
\&        [benchmark start=1]
.Ve
to start the measurement. At the end
.PP
.Vb 1
\&        [benchmark]
.Ve
will display the time used. Bear in mind that it is not precise, and
that there may be variation due to system conditions. Also, the longer
the times and the bigger the list, the better the comparison.
.PP
To see the system/user breakdown, do:
.PP
.Vb 1
\&        [benchmark verbose=1]
.Ve
In general, \*(L"user\*(R" time measures Interchange processing time and and
the rest are indicative of the database access overhead, which can
vary widely from database to database.
.PP
Optimizations
.Ip "\(bu" 4
[PREFIX-tag] is faster than [parsed-tag]
.Sp
.Vb 1
\&                [loop prefix=foo search="ra=yes"]
.Ve
.PP
.Vb 7
\&                        [foo-data products image]
\&                                is slightly faster than
\&                        [foo-field image]
\&                                which is MUCH faster than
\&                        [data products image [foo-code]]
\&                                which is faster than
\&                        [data table=products column=image key="[foo-code]"]
.Ve
.Vb 1
\&                [/loop]
.Ve
The loop tags are interpreted by means of fast regular expression
scans of the loop container text, and fetch an entire row of data in
one query. The [data ...]  \s-1ITL\s0 tag interpretation is delayed until
after the loop is finished, whereby the \s-1ITL\s0 tag parser must find the
tag, build a parameter list, then fetch the data with a separate
query. If there are repeated references to the same field in the loop,
the speedup can be 10x or more.
.Ip "\(bu" 4
Pre-fetch data with rf=field1,field2,field3 and access with
[PREFIX-param field1].
.PP
mv_return_fields (otherwise known as \*(L"rf\*(R" in one-click terminology)
sets the fields that are returned from a search. Once they are
returned, they can be accessed with [PREFIX-param field]. They can
also be referenced with [PREFIX-pos N], where N is a digit
representing the ordinal position (i.e. starting with 0) in the list
of fields.
.PP
The following are equivalent:
.PP
.Vb 4
\&        Benchmark loop-field list: [benchmark start=1]
\&        <!-- [loop search="ra=yes/st=db"]
\&                [loop-code] price: [loop-field price] [/loop] -->
\&        TIME: [benchmark]
.Ve
.Vb 4
\&        Benchmark loop-param list: [benchmark start=1]
\&        <!-- [loop search="ra=yes/st=db/rf=sku,price"]
\&                [loop-code] price: [loop-param price] [/loop] -->
\&        TIME: [benchmark]
.Ve
but the second is much, much faster.
.Ip "\(bu" 4
[PREFIX-alternate N] is available for row counting and display.
.PP
A common need when building tables is to conditionally close the table
row or data containers. I see a lot of:
.PP
.Vb 4
\&        [loop search="ra=yes"]
\&        [calc] return '<TR>' if [loop-increment] == 1; return[/calc]
\&        [calc] return '' if [loop-increment] % 3; return '</TR>' [/calc]
\&        [/loop]
.Ve
Much faster, by a few orders of magnitude, is:
.PP
.Vb 4
\&        [loop search="ra=yes"]
\&        [loop-change 1][condition]1[/condition]<TR>[/loop-change 1]
\&        [loop-alternate 3]</TR>[/loop-alternate]
\&        [/loop]
.Ve
.Vb 2
\&        If you think you need to close the final row by checking the
\&        final count, look at this:
.Ve
.Vb 5
\&        [loop search="ra=yes"]
\&        [on-match]
\&                <TABLE>
\&                <TR>
\&        [/on-match]
.Ve
.Vb 4
\&        [list]
\&                        <TD>[loop-code]</TD>
\&                [loop-alternate 3]</TR><TR>[/loop-alternate]
\&        [/list]
.Ve
.Vb 4
\&        [on-match]
\&                </TR>
\&                </TABLE>
\&        [/on-match]
.Ve
.Vb 3
\&        [no-match]
\&                No match, sorry.
\&        [/no-match]
.Ve
[/loop]
.PP
This is a hundred times faster than anything you can build with
multiple [calc] tags.
.Ip "\(bu" 4
Use simple go/nogo comparisons in [if ...]
.PP
Consider these two snippets:
.PP
.Vb 1
\&        [if scratch|value|cgi key] THEN [/if]
.Ve
and:
.PP
.Vb 1
\&        [if scratch|value|cgi key == '1'] THEN [/if]
.Ve
The first one doesn't require Perl evaluation. It simply checks to see
if the value is blank or 0, and returns true if it is anything but. Of
course this requires setting your test values to blank or 0 instead of
\&\*(L"No\*(R" or \*(L" \*(R" or somesuch, but it is anywhere from 20\-35% faster.
.PP
Try it on the foundation demo:
.PP
.Vb 1
\&        ---- begin test ---
.Ve
.Vb 5
\&        Overhead:
\&        [benchmark start=1]
\&                <!-- [loop search="ra=yes"][set cert][loop-field gift_cert][/set][/loop] -->
\&        [benchmark]
\&        <P>
.Ve
.Vb 12
\&        if scratch compare:
\&        [benchmark start=1]
\&                <!--
\&                [loop search="ra=yes"]
\&                [set cert][loop-field gift_cert][/set]
\&                [loop-code] [if scratch cert] YES [else] NO [/else][/if]
\&                [loop-code] [if scratch cert] YES [else] NO [/else][/if]
\&                [loop-code] [if scratch cert] YES [else] NO [/else][/if]
\&                [loop-code] [if scratch cert] YES [else] NO [/else][/if]
\&                [loop-code] [if scratch cert] YES [else] NO [/else][/if]
\&                [/loop]
\&                -->
.Ve
.Vb 2
\&        [benchmark]
\&        <P>
.Ve
.Vb 14
\&        if scratch compare eq 1:
\&        [benchmark start=1]
\&                <!--
\&                [loop search="ra=yes"]
\&                [set cert][loop-field gift_cert][/set]
\&                [loop-code] [if scratch cert == 1] YES [else] NO [/else][/if]
\&                [loop-code] [if scratch cert == 1] YES [else] NO [/else][/if]
\&                [loop-code] [if scratch cert == 1] YES [else] NO [/else][/if]
\&                [loop-code] [if scratch cert == 1] YES [else] NO [/else][/if]
\&                [loop-code] [if scratch cert == 1] YES [else] NO [/else][/if]
\&                [/loop]
\&                -->
\&        [benchmark]
\&        <P>
.Ve
.Vb 1
\&        [page @@MV_PAGE@@]Again[/page]
.Ve
.Vb 1
\&        ---- end test ---
.Ve
.Ip "\(bu" 4
Use [PREFIX-calc] instead of [calc] or [perl]
.PP
You can execute the same code as [calc] with [PREFIX-calc], which has
two benefits:
.Ip "11." 4
.IX Item "11."
It doesn't require \s-1ITL\s0 parsing.
.Ip "12." 4
.IX Item "12."
It is executed during the loop instead of after it.
.PP
The [PREFIX-calc] object has complete access to all normal embedded
Perl objects like \f(CW$Values\fR, \f(CW$Carts\fR, \f(CW$Tag\fR, and such. If you want to make
a data table (i.e. \*(L"products\*(R" or \*(L"pricing\*(R") available for access
inside of it, just do:
.PP
.Vb 1
\&        [perl tables="products pricing"] [/perl]
.Ve
prior to list start. Now you can do something like:
.PP
.Vb 7
\&    [loop search="ra=yes"]
\&        [loop-calc]
\&            $desc = $Tag->data('products', 'description', '[loop-code]');
\&            $link = $Tag->page('[loop-code]');
\&            return "$link $desc </A>";
\&        [/loop-calc] <BR>
\&    [/loop]
.Ve
.Ip "\(bu" 4
\&\s-1ADVANCED:\s0 Precompile and execute with [PREFIX-sub] and [PREFIX-exec]
.PP
For repetitive routines, you can achieve a considerable savings in \s-1CPU\s0
by pre-compiling your embedded Perl code.
.PP
In the \*(L"Construct Something\*(R" demo, the \fIbar_link()\fR routine in
catalog_before.cfg is an example of compiling the subroutine once at
catalog configuration time.
.PP
You can also compile routines at the time of the list execution with
[item-sub routine] \s-1CODE\s0 [/item-sub]. This means only one Safe
evaluation is done \*(-- every time the [loop-exec routine] is called, it
is done fast as a call to the routine. This can be 10 times or more
faster than separate [calc] calls, or 5 times faster than separate
[PREFIX-calc] calls.
.Ip "" 4
Example:
.Sp
.Vb 1
\&        [benchmark start=1]
.Ve
.PP
.Vb 1
\&        [benchmark]
.Ve
.Vb 1
\&        <P>
.Ve
.Vb 11
\&        [benchmark start=1]
\&        loop-sub and loop-exec:
\&          <!--
\&                [loop search="st=db/fi=country/ra=yes/ml=1000"]
\&                [loop-sub country_compare]
\&                        my $code = shift;
\&                        return "code '$code' reversed is " . reverse($code);
\&                [/loop-sub]
\&                [loop-exec country_compare][loop-code][/loop-exec]
\&                [/loop]
\&          -->
.Ve
.Vb 1
\&        [benchmark]
.Ve
.Ip "\(bu" 4
\&\s-1ADVANCED:\s0 Execute and save with [query ...], then use an embedded Perl
routine.
.PP
You can run [query arrayref=myref sql=\*(L"query\*(R"], which saves the
results of the search/query in a Perl reference. It is then available
in \f(CW$Tmp\fR->{myref}. (Of course, \*(L"myref\*(R" can be any arbitrary name.)
.PP
This is the fastest possible method to display a list.
.Ip "" 4
Observe:
.Sp
.Vb 1
\&        --- begin test code ---
.Ve
.PP
.Vb 5
\&        [benchmark start=1] Embedded Perl
\&        <!--
\&        [query arrayref=myref sql="select sku, price, description from products"]
\&                <!-- make query, this container text is not used. -->
\&        [/query]
.Ve
.Vb 15
\&        [perl]
\&                # Get the query results, has multiple fields
\&                my $ary = $Tmp->{myref};
\&                my $out = '';
\&                foreach $line (@$ary) {
\&                        my ($sku, $price, $desc) = @$line;
\&                        if($sku eq $Scratch->{waiting_for}) {
\&                                $out .= "We were waiting for this one!!!!\en";
\&                        }
\&                        $out .= "sku: $sku price: $price description: $desc\en";
\&                }
\&                return $out;
\&        [/perl]
\&        -->
\&        TIME: [benchmark]
.Ve
.Vb 7
\&        [benchmark start=1] All loop
\&        <!--
\&        [query list=1 sql="select sku, price, description from products"]
\&                [if scratch waiting_for eq '[sql-code]']We were waiting for this one!!!!
\&                [/if] sku: [sql-code]price: [sql-param price] desc: [sql-param description]
\&        [/query]
\&        -->
.Ve
.Vb 1
\&        TIME: [benchmark]
.Ve
.Vb 1
\&        --- end test code ---
.Ve
.Ip "\(bu" 4
Other things that help:
.RS 4
.Ip "\(bu" 8
Avoid interpolate=1 when possible. A separate tag parser must be
spawned every time you do this. Many times people use this without
needing it.
.Ip "\(bu" 8
Avoid saving large values to Scratch, as these have to be written to
the users session. If you need them only for the current page, clear
at the end by using [tmp scratch_var] contents [/tmp], which is the
same as  [seti scratch_var] contents [/seti] except clears the value
before the session is written. You can also use [scratchd scratch_var]
to return the contents and delete them from the session at the same
time.
.Ip "\(bu" 8
Use the [more-list] facility to break up your large searches. You can
use them in [query ....] and [loop ...] searches as well \*(-- see the
docs.
.RE
.RS 4
.RE
.SH "Using Interchange with Oracle"
.IX Header "Using Interchange with Oracle"
Question: should we be using the \s-1DBI\s0 ChopBlanks setting for Oracle or
is Interchange trimming trailing space from \s-1CHAR\s0 fields itself?
.PP
\&\s-1IC\s0 daemon user should have environment variables \s-1ORACLE_HOME\s0 and
possibly \s-1NLS_LANG\s0 set.
.PP
Mark Johnson (Red Hat E-Business Professional Services) wrote this
trigger on \s-1TABLE_NAME\s0 to update the \s-1MOD_TIME\s0 column on insert or
update. The user must have been granted the \s-1RESOURCE\s0 role to create
triggers. Here it is:
.PP
\&\s-1CREATE\s0 \s-1TRIGGER\s0 tr_modtime_for_TABLE_NAME \s-1BEFORE\s0 \s-1INSERT\s0 \s-1OR\s0 \s-1UPDATE\s0 \s-1ON\s0
\&\s-1TABLE_NAME\s0 \s-1FOR\s0 \s-1EACH\s0 \s-1ROW\s0 \s-1BEGIN\s0
.PP
new.MOD_TIME := \s-1SYSDATE\s0; \s-1END\s0; /
.SH "Using Interchange with PostgreSQL"
.IX Header "Using Interchange with PostgreSQL"
Make sure you have \s-1DBD:\s0:Pg installed and tested. Make sure
\&\s-1POSTGRES_INCLUDE\s0 and \s-1POSTGRES_LIB\s0 environment variables are set.
.SH "Using Interchange with MySQL"
.IX Header "Using Interchange with MySQL"
Permissions. test_ databases usually special.
.SH "Using Interchange with Apache"
.IX Header "Using Interchange with Apache"
.Vb 4
\& Date: Thu, 7 Sep 2000 12:08:37 -0700
\&From: Bill Randle <billr@exgate.tek.com>
\&To: minivend-users@minivend.com
\&Subject: Re: [mv] no /cgi-bin/storename/
.Ve
On Sep 6,  5:13am, Victor Nolton wrote:
} Subject: [mv] no /cgi-bin/storename/
} ******    message to minivend-users from Victor Nolton <ven@pragakhan.com> ******
}
} I've noticed some of the catalogs I've done are not indexed well with
} the search engine, though most pages have meta tags, there is a
} robot.txt file and so on and so forth.I assume it's due to the
} cgi-bin in the url (not sure).
}
} I'd like to start having stores be like
}
} http://www.yourdomain.com/index.html
} http://www.yourdomain.com/ord/basket.html
} instead of
} http://www.yourdomain.com/cgi-bin/yourstore/index.html
} http://www.yourdomain.com/cgi-bin/yourstore/ord/basket.html
}
} how do you accomplish this? I assume it can be done somehow.
.PP
In addition to using mod_minivend, previosuly suggested, you can do this
with Apache rewrite rules in the VirtualHost directive for yourdomain.com:
.PP
<VirtualHost a.b.c.d>
    ServerAdmin support@mainhost.com
    DocumentRoot /home/httpd/html/yourstore
    ServerName www.yourdomain.com
    ErrorLog logs/yourdomain-error_log
    CustomLog logs/yourdomain-access_log common
    ScriptAlias /cgi-bin/ \*(L"/home/httpd/cgi-bin/\*(R"
    RewriteEngine On
    RewriteRule    ^$      /cgi-bin/yourstore/index.html    [\s-1PT\s0,L]
    RewriteRule    ^/$     /cgi-bin/yourstore/index.html    [\s-1PT\s0,L]
    RewriteRule    ^/index\e.html$  /cgi-bin/yourstore/index.html    [\s-1PT\s0,L]
    RewriteRule    ^/cgi-bin/yourstore/.*   \-           [\s-1PT\s0,L]
    RewriteRule    ^/(.*)      /cgi-bin/yourstore/$1        [\s-1PT\s0,L]
</VirtualHost>
.PP
I just did this for a client and it works quite well (as long as you're
using a fairly recent version of Apache as your webserver).
.PP
.Vb 1
\&        -Bill
.Ve
.SH "Perl/Interchange FAQ"
.IX Header "Perl/Interchange FAQ"
.Vb 4
\& Date: Wed, 14 Feb 2001 10:20:18 -0600
\&From: Cameron B. Prince <cameron@akopia.com>
\&To: support@akopia.com
\&Subject: Local Perl Install Steps
.Ve
Hi all,
.PP
Here's the steps I took to install the local perl for the client who had an
old system perl (5.004) and couldn't upgrade.
.PP
This was tested on a Red Hat v5.x system as well as v7.0.
.PP
Cameron
.PP
1) Login as user. In this example, we'll call the user bob. Bob's home directory is /home/bob.
.PP
2) Get the perl tarball and extract it in /home/bob. (tar \-xzvf perl-5.6.0.tar.gz)
.PP
3) Create a directory for the local perl. (mkdir /home/bob/local-perl)
.PP
4) Compile perl.
.PP
.Vb 1
\&        A) cd perl-5.6.0
.Ve
.Vb 1
\&        B) sh Configure
.Ve
.Vb 1
\&        C) Choose all the defaults until you get to: "Directories to use for library searches?" Here you want to enter the new local perl path, as well as the defaults. So you should enter something like: /home/bob/local-perl/lib /usr/local/lib /lib /usr/lib
.Ve
.Vb 1
\&        D) Continue choosing defaults till you get to: "Any additional ld flags (NOT including libraries)?" This should be: -L/home/bob/local-perl/lib
.Ve
.Vb 1
\&        E) Continue choosing defaults till you get to: "Installation prefix to use? (~name ok)" This should be: /home/bob/local-perl
.Ve
.Vb 1
\&        F) Choose all defaults till you get to: "Directory /home/bob/local-perl/bin doesn't exist.  Use that name anyway?" Enter y.
.Ve
.Vb 1
\&        G) Continue choosing defaults till you get to: "Do you want to install perl as /usr/bin/perl?" Enter n.
.Ve
.Vb 1
\&        H) Continue choosing defaults till you get to: "Directory /home/bob/local-perl/bin doesn't exist.  Use that name anyway?" Enter y.
.Ve
.Vb 1
\&        I) Directory /home/bob/local-perl/bin doesn't exist.  Use that name anyway? Enter y.
.Ve
.Vb 1
\&        J) Continue taking defaults till you return to a prompt.
.Ve
.Vb 1
\&        K) make
.Ve
.Vb 1
\&        L) make test
.Ve
.Vb 1
\&        M) make install
.Ve
.Vb 1
\&        O) /home/bob/local-perl/bin/perl -v
.Ve
.Vb 1
\&                You should see: This is perl, v5.6.0
.Ve
5) edit /home/bob/.bash_rc
.PP
.Vb 2
\&                Change: PATH=$PATH:$HOME/bin
\&                To: PATH=/home/bob/local-perl/bin:$PATH:$HOME/bin
.Ve
6) Logout and log back in.
.PP
7) which perl
.PP
.Vb 1
\&                You should see: ~/local-perl/bin/perl or /home/bob/local-perl/bin/perl
.Ve
8) perl \-MCPAN \-e 'install Bundle::Interchange'
.PP
Keep running this until you see:
.PP
\&\s-1MD5\s0 is up to date.
\&\s-1MIME:\s0:Base64 is up to date.
\&\s-1URI\s0 is up to date.
Net::FTP is up to date.
\&\s-1MIME:\s0:Base64 is up to date.
Digest::MD5 is up to date.
\&\s-1HTML:\s0:Tagset is up to date.
\&\s-1HTML:\s0:Parser is up to date.
\&\s-1HTML:\s0:HeadParser is up to date.
\&\s-1LWP\s0 is up to date.
Term::ReadKey is up to date.
Term::ReadLine::Perl is up to date.
Business::UPS is up to date.
\&\s-1SQL:\s0:Statement is up to date.
Storable is up to date.
\&\s-1DBI\s0 is up to date.
Safe::Hole is up to date.
.PP
You may need to get the modules via ftp and install them by hand. For instance, during the test used to create this document, I had to get \s-1URI\s0 and \s-1LWP\s0 and install by hand before everything reported that it was up to date. To do this, follow these steps:
.PP
1) ftp ftp.cpan.org
2) cd /CPAN/modules/by-module/URI
3) bin
4) get \s-1URI-1\s0.10.tar.gz
5) quit
6) tar \-xzvf \s-1URI-1\s0.10.tar.gz
7) cd \s-1URI-1\s0.10
8) perl Makefile.pl
9) make
10) make test
11) make install
.PP
Use the same basic steps for any module not properly installed by using perl \-MCPAN \-e 'install Bundle::Interchange'
.PP
9) Install Interchange as normal.
.PP
.Vb 1
\& ________________________________________
.Ve
Copyright 2001 Red Hat, Inc. Freely redistributable under terms of the
\&\s-1GNU\s0 General Public License.