]> git.sven.stormbind.net Git - sven/tclcurl.git/blob - doc/aolserver.txt
Imported Upstream version 7.19.6
[sven/tclcurl.git] / doc / aolserver.txt
1 There are a number of issues with namespaces in AOLserver 3.x, which I believe
2 are fixed in 4.0, which should be released within a few months. But in the
3 meantime this is what we've had to do for AOLserver 3.2 on Windows 2000.
4
5 Alex Khassin
6
7
8 1.  Under [ns_library shared] directory, create a directory called
9     packages.
10
11 2.  Register this directory as a Tcl module in nsd.tcl:
12         ns_section "ns/server/${servername}/modules"
13         ns_param   packages Tcl
14
15 3.  Place each package into a subdirectory of the same name as the
16     package name (i.e. [ns_library shared]/packages/TclCurl)
17
18 4.  Copy S:\NaviSoft\Server\modules\tcl\am\packages.init.tcl to the
19     [ns_library shared]/packages directory and rename to just init.tcl
20
21 5.  Under AOLserver 4.x (and hopefully in 3.5.x) add to the bottom
22     of this file appropriate commands to register each package:
23         _am_pregister shared <packageName>
24
25 6.  In your code, when you need to use a particular package, instead
26     of 'package require <packageName>', execute 'am_pinit <packageName>'
27
28 7.  This will use the existing package registration under AOLserver
29     4.x and, under AOLserver 3.2, it will first register the package
30     in this interpreter and then use it.
31
32 8.  This is necessary because in AOLserver 3.2, namespaces aren't
33     properly imported into child interpreters.
34
35     Currently dnscrub.com is set up like this for TclCurl and it works.
36
37     Example usage:
38
39         am_pinit TclCurl
40         curl::transfer -url http://am.net/index.htm -file d:/test.htm
41
42 FYI, the code for am_pinit and _am_pregister procs:
43
44         proc am_pinit {package} {
45         # AOLserver 3.2 package/namespace-handling is broken
46         # (namespace/packages don't get imported into child interpreters)
47         # so use this workaround proc instead of 'package require' to
48         # load the package into the current interpreter
49         # (this is obviously slower than copying from master interpeter)
50         # Package names are case-sensitive!
51         # Returns the version of the loaded package
52             set library shared
53             if {[lsearch -exact [package names] $package] == -1} {
54                 ns_log Notice "packages: registering $library/$package"
55                 _am_pregister $library $package
56             }
57             package require $package
58         }
59          
60         proc _am_pregister {library package} {
61         # Registers the package. library is 'shared' or 'private'
62             set dir [ns_library $library]/packages/$package
63             source $dir/pkgIndex.tcl
64         }