| 1 |
'\" |
| 2 |
'\" Copyright (c) 1993 The Regents of the University of California. |
| 3 |
'\" Copyright (c) 1994-1997 Sun Microsystems, Inc. |
| 4 |
'\" |
| 5 |
'\" See the file "license.terms" for information on usage and redistribution |
| 6 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 7 |
'\" |
| 8 |
.TH rename n "" Tcl "Tcl Built-In Commands" |
| 9 |
.so man.macros |
| 10 |
.BS |
| 11 |
'\" Note: do not modify the .SH NAME line immediately below! |
| 12 |
.SH NAME |
| 13 |
rename \- Rename or delete a command |
| 14 |
.SH SYNOPSIS |
| 15 |
\fBrename \fIoldName newName\fR |
| 16 |
.BE |
| 17 |
.SH DESCRIPTION |
| 18 |
.PP |
| 19 |
Rename the command that used to be called \fIoldName\fR so that it |
| 20 |
is now called \fInewName\fR. |
| 21 |
If \fInewName\fR is an empty string then \fIoldName\fR is deleted. |
| 22 |
\fIoldName\fR and \fInewName\fR may include namespace qualifiers |
| 23 |
(names of containing namespaces). |
| 24 |
If a command is renamed into a different namespace, |
| 25 |
future invocations of it will execute in the new namespace. |
| 26 |
The \fBrename\fR command returns an empty string as result. |
| 27 |
.SH EXAMPLE |
| 28 |
.PP |
| 29 |
The \fBrename\fR command can be used to wrap the standard Tcl commands |
| 30 |
with your own monitoring machinery. For example, you might wish to |
| 31 |
count how often the \fBsource\fR command is called: |
| 32 |
.PP |
| 33 |
.CS |
| 34 |
\fBrename\fR ::source ::theRealSource |
| 35 |
set sourceCount 0 |
| 36 |
proc ::source args { |
| 37 |
global sourceCount |
| 38 |
puts "called source for the [incr sourceCount]'th time" |
| 39 |
uplevel 1 ::theRealSource $args |
| 40 |
} |
| 41 |
.CE |
| 42 |
.SH "SEE ALSO" |
| 43 |
namespace(n), proc(n) |
| 44 |
.SH KEYWORDS |
| 45 |
command, delete, namespace, rename |