'''package ifneeded''' ''package version ?script?'' This command typically appears only in system configuration scripts to set up the package database. It indicates that a particular version of a particular package is available if needed, and that the package can be added to the interpreter by executing ''script''. The script is saved in a database for use by subsequent '''[package require]''' commands; typically, ''script'' sets up auto-loading for the commands in the package (or calls '''[load]''' and/or '''[source]''' directly), then invokes '''[package provide]''' to indicate that the package is present. There may be information in the database for several different versions of a single package. If the database already contains information for ''package'' and ''version'', the new ''script'' replaces the existing one. If the ''script'' argument is omitted, the current script for version ''version'' of package ''package'' is returned, or an empty string if no '''package ifneeded''' command has been invoked for this ''package'' and ''version''. ---- The package selection algorithms inside [package require] need to trust that the [package ifneeded] commands have provided accurate information. That is, in order for package selection to work properly, it needs to be true that the command '''package ifneeded''' ''$pkg'' ''$version'' ''$script'' accurately and truthfully indicates that '''uplevel #0''' ''$script'' will cause the command '''package provide''' ''$pkg'' ''$version'' to be evaluated (or equivalent [Tcl_PkgProvide] call). ---- See also: * [package] * [package provide] * [package require] ---- !!!!!! %|[Tcl syntax help] | [Category Command] | [Category Introspection] |% !!!!!!