summaryrefslogtreecommitdiffstats
path: root/doc/package.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/package.n')
-rw-r--r--doc/package.n50
1 files changed, 12 insertions, 38 deletions
diff --git a/doc/package.n b/doc/package.n
index 5687480..dd1fc36 100644
--- a/doc/package.n
+++ b/doc/package.n
@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
+'\"
.TH package n 7.5 Tcl "Tcl Built-In Commands"
.so man.macros
.BS
@@ -12,8 +12,7 @@
package \- Facilities for package loading and version control
.SH SYNOPSIS
.nf
-\fBpackage files\fR \fIpackage\fR
-\fBpackage forget\fR ?\fIpackage package ...\fR?
+\fBpackage forget ?\fIpackage package ...\fR?
\fBpackage ifneeded \fIpackage version\fR ?\fIscript\fR?
\fBpackage names\fR
\fBpackage present \fIpackage \fR?\fIrequirement...\fR?
@@ -28,6 +27,7 @@ package \- Facilities for package loading and version control
\fBpackage prefer \fR?\fBlatest\fR|\fBstable\fR?
.fi
.BE
+
.SH DESCRIPTION
.PP
This command keeps a simple database of the packages available for
@@ -44,21 +44,12 @@ primarily by system scripts that maintain the package database.
The behavior of the \fBpackage\fR command is determined by its first argument.
The following forms are permitted:
.TP
-\fBpackage files\fR \fIpackage\fR
-.
-Lists all files forming part of \fIpackage\fR. Auto-loaded files are not
-included in this list, only files which were directly sourced during package
-initialization. The list order corresponds with the order in which the
-files were sourced.
-.TP
-\fBpackage forget\fR ?\fIpackage package ...\fR?
-.
+\fBpackage forget ?\fIpackage package ...\fR?
Removes all information about each specified package from this interpreter,
including information provided by both \fBpackage ifneeded\fR and
\fBpackage provide\fR.
.TP
\fBpackage ifneeded \fIpackage version\fR ?\fIscript\fR?
-.
This command typically appears only in system configuration
scripts to set up the package database.
It indicates that a particular version of
@@ -80,7 +71,6 @@ or an empty string if no \fBpackage ifneeded\fR command has
been invoked for this \fIpackage\fR and \fIversion\fR.
.TP
\fBpackage names\fR
-.
Returns a list of the names of all packages in the
interpreter for which a version has been provided (via
\fBpackage provide\fR) or for which a \fBpackage ifneeded\fR
@@ -93,7 +83,6 @@ This command is equivalent to \fBpackage require\fR except that it
does not try and load the package if it is not already loaded.
.TP
\fBpackage provide \fIpackage \fR?\fIversion\fR?
-.
This command is invoked to indicate that version \fIversion\fR
of package \fIpackage\fR is now present in the interpreter.
It is typically invoked once as part of an \fBifneeded\fR script,
@@ -103,10 +92,9 @@ provided by a previous \fBpackage provide\fR command.
If the \fIversion\fR argument is omitted, then the command
returns the version number that is currently provided, or an
empty string if no \fBpackage provide\fR command has been
-invoked for \fIpackage\fR in this interpreter.
+invoked for \fIpackage\fR in this interpreter.
.TP
-\fBpackage require \fR\fIpackage \fR?\fIrequirement...\fR?
-.
+\fBpackage require\fR \fIpackage \fR?\fIrequirement...\fR?
This command is typically invoked by Tcl code that wishes to use
a particular version of a particular package. The arguments
indicate which package is wanted, and the command ensures that
@@ -152,13 +140,11 @@ package, then the command returns an error.
.RE
.TP
\fBpackage require \-exact \fIpackage version\fR
-.
This form of the command is used when only the given \fIversion\fR
of \fIpackage\fR is acceptable to the caller. This command is
equivalent to \fBpackage require \fIpackage version\fR-\fIversion\fR.
.TP
\fBpackage unknown \fR?\fIcommand\fR?
-.
This command supplies a
.QW "last resort"
command to invoke during
@@ -180,36 +166,30 @@ If \fIcommand\fR is specified as an empty string, then the current
\fBpackage unknown\fR script is removed, if there is one.
.TP
\fBpackage vcompare \fIversion1 version2\fR
-.
Compares the two version numbers given by \fIversion1\fR and \fIversion2\fR.
Returns -1 if \fIversion1\fR is an earlier version than \fIversion2\fR,
-0 if they are equal, and 1 if \fIversion1\fR is later than \fIversion2\fR.
+0 if they are equal, and 1 if \fIversion1\fR is later than \fBversion2\fR.
.TP
\fBpackage versions \fIpackage\fR
-.
Returns a list of all the version numbers of \fIpackage\fR
for which information has been provided by \fBpackage ifneeded\fR
commands.
.TP
\fBpackage vsatisfies \fIversion requirement...\fR
-.
Returns 1 if the \fIversion\fR satisfies at least one of the given
requirements, and 0 otherwise. Each \fIrequirement\fR is allowed to
have any of the forms:
.RS
.TP
min
-.
This form is called
.QW min-bounded .
.TP
min-
-.
This form is called
.QW min-unbound .
.TP
min-max
-.
This form is called
.QW bounded .
.RE
@@ -291,8 +271,8 @@ error.
.PP
When an interpreter is created, its initial selection mode value is set to
.QW stable
-unless the environment variable \fBTCL_PKG_PREFER_LATEST\fR is set
-(to any value) or the Tcl package itself is unstable. Otherwise
+unless the environment variable \fBTCL_PKG_PREFER_LATEST\fR
+is set. If that environment variable is defined (with any value) then
the initial (and permanent) selection mode value is set to
.QW latest .
.RE
@@ -348,10 +328,8 @@ Once you have done this, packages will be loaded automatically
in response to \fBpackage require\fR commands.
See the documentation for \fBpkg_mkIndex\fR for details.
.SH EXAMPLES
-.PP
To state that a Tcl script requires the Tk and http packages, put this
at the top of the script:
-.PP
.CS
\fBpackage require\fR Tk
\fBpackage require\fR http
@@ -360,19 +338,15 @@ at the top of the script:
To test to see if the Snack package is available and load if it is
(often useful for optional enhancements to programs where the loss of
the functionality is not critical) do this:
-.PP
.CS
if {[catch {\fBpackage require\fR Snack}]} {
- # Error thrown - package not found.
- # Set up a dummy interface to work around the absence
+ # Error thrown - package not found.
+ # Set up a dummy interface to work around the absence
} else {
- # We have the package, configure the app to use it
+ # We have the package, configure the app to use it
}
.CE
.SH "SEE ALSO"
msgcat(n), packagens(n), pkgMkIndex(n)
.SH KEYWORDS
package, version
-'\" Local Variables:
-'\" mode: nroff
-'\" End: