Hi

I'm wondering if actually is worth keeping these lines of code in
Rivet_SendContent

        Tcl_Obj *infoscript = Tcl_NewStringObj("info script ", -1);
        Tcl_IncrRefCount(infoscript);
        Tcl_AppendToObj(infoscript, r->filename, -1);
        Tcl_EvalObjEx(interp, infoscript, TCL_EVAL_DIRECT);
        Tcl_DecrRefCount(infoscript);

the purpose of running this Tcl fragment is to coax 'info script' to
return the full path to the current script. Notice that this code is
unconditionally run on every request handled by mod_rivet.c. Not a big
deal in terms of performance, but we could save some time at every
request if we approach the problem in a different way (and in any case
it's not a good design to have code computing something that could never
be used when this same information can be obtained by other means and
only on demand)

My proposal is to rename Tcl's info command in Rivet:init (to a
different namespace?) and provide our own 'info' command which will fall
back to the default in every case except when the command call reads
exactly 'info script'. In this case the string returned by

[::rivet::env SCRIPT_FILENAME]

would be returned or the same information could be fetched from
request_rec by a new specific command (the presence of a specific
environment variable is configuration dependent, I still have to
understand whether SCRIPT_FILENAME is guaranteed to exist)

-- 
-- Massimo Manghi

Dipartimento di Neuroscienze
Unità di Biofisica e Fisica Medica
via Volturno 39
43125 Parma

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org

Reply via email to