Previous section   Next section

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 12.  Script Libraries and Packages

The package Command

The package command has several operations that are used primarily by the pkg_mkIndex procedure and the automatic loading facility. These operations are summarized in Table 12-2.

Table 12-2. The package command.
package forget packageDeletes registration information for package.
package ifneeded package ?command?Queries or sets the command used to set up automatic loading of a package.
package namesReturns the set of registered packages.
package provide package versionDeclares that a script file defines commands for package with the given version.
package require package ?version? ?-exact?Declares that a script uses package. The -exact flag specifies that the exact version must be loaded. Otherwise, the highest matching version is loaded.
package unknown ?command?Queries or sets the command used to locate packages.
package vcompare v1 v2Compares version v1 and v2. Returns 0 if they are equal, minus 1 if v1 is less than v2, or 1 if v1 is greater than v2.
package versions packageReturns which versions of the package are registered.
package vsatisfies v1 v2Returns 1 if v1 is greater or equal to v2 and still has the same major version number. Otherwise returns 0.

      Previous section   Next section