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:48:30 CET

just80n@gmail.com <just80n@gmail.com> wrote:
> And would this give me the errors that would show up if I typed
> "gimmedat" (the name of my example proc in my first msg) on the prompt
> of my modified wish?

errors are a different story: use the "catch" command to deal
with those.

> I basically want everything that would have been printed on the screen
> if I typed "gimmedat" at the command line REDIRECTED to a string
> (while keeping output to command line)

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
Received on Fri Dec 23 19:02:12 2005