Re: (newbie) storing outputs from all lines of procs into a string
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: (newbie) storing outputs from all lines of procs into a string

From: Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date: Mon Dec 19 2005 - 16:53:59 CET

Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> wrote:
> these are the options:
> run the procedure in a separate process, (with exec) and
> it returns all of the subprocess' output
> run the procedure in a separate interpreter (see
> doku for "interp", and for that interp you can replace
> "puts" with whatever suits you better, even calling
> master's original puts.
> If you need any sideffects (e.g. global variables) of that
> procedure in the current interpreter, then the above two
> ways are ruled out, but you can still replace puts before
> calling gimmedat, and restore the original puts back
> immediately afterwards:
> rename puts _puts
> proc puts {args} { log $args somewhere; eval _puts $args }
> gimmedat
> rename _puts puts

and another one:
  If you're only interested in the "puts" from that procedure,
but *not* in any puts' inside the nested procedures (e.g. the bid...)
then you can regsub the procedure's body, and change all the puts
to (e.g.) "logputs" and provide an appropriate procedure "logputs"
on your own for your needs.
Received on Fri Dec 23 19:02:12 2005