First skirmishes with Safe Tcl interps, pluginmgr, Tablelist and homespun package...


I am trying to create a plugin environment for my application which
will allow simple user written scripts to be run. The complication is
that I don't want to overly restrict what commands the user can run
(they are Tcl newbies and it would be hard to explain the

Unfortunately my code is on a restricted stand--alone machine at work
and I am at home typing from memory...


I have found pluginmgr to be a very useful framework but got caught
out by the following

1) using the list subcommand caused a problem if the manager was
created with the -setup option but nothing has been loaded the sip
variable is empty. To get around this I create two managers, one to do
use for list and another to do all the heavy lifting

2) the list command doesn't show plugins that are created using the
Tcl Modules (they seem to be invisible to package names). This is a
snag only because I don't want to have to get users to create and
maintain pkgIndex.tcl files. However it is still possible to load the
module based plugins if tcl::tm::path add is used first.

Using the interpreter subcommand I can get the name of the current
slave and do a safe::loadTk which works fine and I can create simple
buttons and even a ttk::labelframe.

However when I try to use a Tablelist from within the slave I get an

script error
invoked from within
"source {$p(:196:)/tablelistWidget.tcl}"
(in namespace eval "::" script line 1)
invoked from within
"namespace eval :: $auto_index($name)"
(procedure "auto_load" line 13)
invoked from within
"auto_load $name [uplevel 1 {::namespace current}]"
(autoloading "tablelist::tablelist")
(procedure "::unknown" line 23)
invoked from within
"tablelist::tablelist .tl"
(procedure "run" line 8)
invoked from within
invoked from within
"$sip eval $args"
(procedure "::pluginmgr::Snit_methoddo" line 9)
invoked from within
"espresso do run"
(file "butt_plug.tcl" line 130)

My Package

Inside the slave I can package require "oow", my Snit-based wrapper
around and a C based extension I have written. However, when calling
the oow command to create an oow object the oow command is not

If I alias oow back to the master interpreter it works fine but I then
hit the following problem

oow r -file c:/thing/thang

create an object command "r" which performs operations on the
specified file ( a bespoke database)

"r' has a subcommand called "setvars" which maps field in the current
record of the database on to Tcl variables using upvar:

r setvars A B C

will create variables A B C in the calling scope and they will contain
the respective values from the database; works fine in normal scripts
but not in my slave. I assume this is because they are being upvar'd
in the scope of the master?


Sorry to dump so much out there but any guidance and insights will be
much appreciated :)

kind regards

Julian H J Loaring