1rename(n)                    Tcl Built-In Commands                   rename(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       rename - Rename or delete a command
9

SYNOPSIS

11       rename oldName newName
12______________________________________________________________________________
13

DESCRIPTION

15       Rename  the  command  that  used to be called oldName so that it is now
16       called newName.  If newName is an empty string then oldName is deleted.
17       oldName and newName may include namespace qualifiers (names of containā€
18       ing namespaces).  If a command is renamed into a  different  namespace,
19       future invocations of it will execute in the new namespace.  The rename
20       command returns an empty string as result.
21

EXAMPLE

23       The rename command can be used to wrap the standard Tcl  commands  with
24       your  own  monitoring  machinery.  For example, you might wish to count
25       how often the source command is called:
26
27              rename ::source ::theRealSource
28              set sourceCount 0
29              proc ::source args {
30                  global sourceCount
31                  puts "called source for the [incr sourceCount]'th time"
32                  uplevel 1 ::theRealSource $args
33              }
34

SEE ALSO

36       namespace(n), proc(n)
37

KEYWORDS

39       command, delete, namespace, rename
40
41
42
43Tcl                                                                  rename(n)
Impressum