share procedures between multiple tcl applications?
|
|
Rather than sourcing the files explicitly, build a tcl library:
Step 1. Put the files in a common directory
Step 2. Build the tclIndex for the "library". I use a Makefile with
a convention like:
install.index:
(cd ${DESTDIR}/tclscripts/lib;
echo `source /usr/local/lib/tcl/init.tcl;
auto_mkindex . *.tk` | tcl ; exit 0)
Step 3. Modify your tcl scripts to reference the library:
e.g.:
# local additions
lappend auto_path /usr/local/lib/tcl_local $env(RDS_TCL_SCRIPTS)/lib
Now, as soon as your script tried to reference a procedure in the library,
the "unknown" command autoloads the procedure for you.
Contributed by Joe VanAndel
|
|
|