On 2005.02.07, dan chak <[EMAIL PROTECTED]> wrote:
> Well, I have said from the start that the _only_ time I don't want my
> custom proc used is during the cloning process.  So other times
> include the private tcl library and tcl/adp evaluation.

OK, then this should work:

--- 000-redefine-proc.tcl ---

    set script {
        rename proc _proc
        _proc proc {name args body} {
            # your new proc def here
        }
    }
    ns_ictl oncreate [list ns_ictl save "[ns_ictl get]\n$script"]
    eval $script

--- 999-redefine-proc.tcl ---

    rename proc {}
    rename _proc proc

---

In 000-redefine-proc.tcl, we set up the new [proc], so that it's in
effect for sourcing the private Tcl library.  We register it to be
defined in the oncreate script, so that it happens in any new child
interps as well.

In 999-redefine-proc.tcl, we blow away the new [proc] and restore the
old [proc], so that when the master interp. introspects its state and
builds the master init script, our new [proc] def. doesn't get into that
master init script.  This way, when we create child interps, the real
[proc] is being called directly.


By the way, I just ran into some strange bug in [ns_ictl oncreate], see:

    nscp 3> ns_ictl oncreate [list ns_log notice "oncreate script"]

In the server log:

    [07/Feb/2005:14:20:11][6400.1092254640][-nscp:2-] Notice: nscp: dossy 3: 
ns_ictl oncreate [list ns_log notice "oncreate script"]
    [07/Feb/2005:14:20:11][6400.1092254640][-nscp:2-] Error:

        while executing
    "ns_ictl oncreate [list ns_log notice "oncreate script"]"


Using [ns_ictl oninit] seems to work, but this bothers me -- this did
work yesterday, I could have sworn ... :-)  You may need to change the
[ns_ictl oncreate] to [ns_ictl oninit] in 000-redefine-proc.tcl above.


-- Dossy

--
Dossy Shiobara                       mail: [EMAIL PROTECTED]
Panoptic Computer Network             web: http://www.panoptic.com/
  "He realized the fastest way to change is to laugh at your own
    folly -- then you can let go and quickly move on." (p. 70)


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to