Version 3 of package names

Updated 2004-02-10 16:30:46

package names

Returns a list of the names of all packages in the interpreter for which a version has been provided (via package provide) or for which a package ifneeded script is available. The order of elements in the list is arbitrary.


package names will only deliver all available packages if it has searched all package indices before. To force this, do a dummy package require before:

 catch {package require nonexistentName}
 package names

DGP - To be more precise, [package names] returns a list of all the package names that are already known to the [package] command. That is not the same as all the names that could become known by operation of the [package unknown] callback.

The default [package unknown] callback is [tclPkgUnknown] and it is that default callback that exhibits the behavior described above -- after one run, all installed package names are known. The [package unknown] interface does not require that behavior, and other callbacks may not (IMHO, should not) implement it.


See also:


Tcl syntax help - Category Command - Category Introspection