Purpose: to provide a command that allows one to see what extensions/packages are available within a particular interpreter's environment, as well as what commands/procs are available within a particular extension/package. ---- The following code is a first draft at providing this functionality. It is incomplete - currently the code only outputs a sorted list of packages available to '''[package] require''', along with their versions. I'll hopefully have time to enhance this to add the ability to list commands from a package - once I figure out how to do that. #! /usr/tcl84/bin/tclsh # Name: WhatsAvailable # Purpose: List the packages, versions, and commands within a package # able to be package required by the tcl interpreter. # Version: 1.1 # Author: Larry W. Virden set a [eval [package unknown] Tcl [package provide Tcl]] set pkglist [lsort -dictionary [package names]] foreach i $pkglist { set a [lsort -dictionary [package versions $i] ] puts [format "%s, versions: %s " $i $a] } ---- Basically listing commands provided by a package could be done by creating a slave interpreter, storing all existing namespaces and command names, loading the package in the slave, looking at new namespaces and commands by comparing with the stored state. Afterwards one can delete the slave interpreter. This should work memory neutral with script only packages, but could be a problem with c-coded extensions, that cannot be unloaded so cleanly. [Michael Schlenker] ---- See also [Introspection]. [[ [Category Application] | ]]