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.
8 1. Under [ns_library shared] directory, create a directory called
11 2. Register this directory as a Tcl module in nsd.tcl:
12 ns_section "ns/server/${servername}/modules"
15 3. Place each package into a subdirectory of the same name as the
16 package name (i.e. [ns_library shared]/packages/TclCurl)
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
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>
25 6. In your code, when you need to use a particular package, instead
26 of 'package require <packageName>', execute 'am_pinit <packageName>'
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.
32 8. This is necessary because in AOLserver 3.2, namespaces aren't
33 properly imported into child interpreters.
35 Currently dnscrub.com is set up like this for TclCurl and it works.
40 curl::transfer -url http://am.net/index.htm -file d:/test.htm
42 FYI, the code for am_pinit and _am_pregister procs:
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
53 if {[lsearch -exact [package names] $package] == -1} {
54 ns_log Notice "packages: registering $library/$package"
55 _am_pregister $library $package
57 package require $package
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