Chapter 13
Persistent Procedures
The system maintains an area on disk where you can store persistent Tcl procedures. Anybody with the
EDIT PMETHOD privilege (which will normally be limited to administrators) can use the
store proc
command to store or modify a procedure in this persistent pool.
Anybody can access and source the
procedures in this persistent pool. You cannot store a procedure with the same name as another persistent
procedure—that would redefine that produre to have the new arg list and body.
When you call a function in your Tcl script and that function isn’t already defined as a command or a proc,
the persistent procedure pool is searched for a procedure with a corresponding name, and if it is found, it
is loaded into the interpreter and the command continues execution as if it had always been defined. Of
course, once so referenced, the proc is now defined in the interpreter in case it is used again.
The persistent procedure pool mainly exists for the
CALLER CODE
,
RNA CODE
,
etc
., settings on a box (see
page 57). These settings consist of Tcl code to execute when a user calls in, when a user’s extension is busy,
etc
. These fields are limited in length though, so they often simply contain calls to a persistent procedure.
In addition, by factoring out the behavior from the setting on a box, we centralize the code into one place,
making modification easier. If one or more functions are to made generally available, then they can be
defined in a single file and that file can be added to the
tcl source files
configuration parameter so that
those procs are defined in every interpreter. The persistent procedure pool’s purpose is to hold procs that
are seldom used, or are used by only one or a few mailboxes or under special circumstances, where it would
be inefficient to define them in every interpreter that is created just on the off chance that it will be used.
The functions related to the persistent procedure pool are
store proc
proc name args body
Description
Stores the procedure in the persistent procedure pool. You need the EDIT PMETHOD privilege to execute
this function.
Return values:
Empty string.
162