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 - 18:09:29 CET

suchenwi <richard.suchenwirth-bauersachs@siemens.com> wrote:
> First delete your substitute:
> rename puts {}
> Then you can get the old one back:
> rename _puts puts
> But you should declare OUTPUT as global,

yes, so far.

> and better not use [eval]

Wrong!

> (because it will break up $args to multiple words,

Yes, of course: Separate "words" such as e.g.:
  -nonewline, stderr and "hello world!"
Yes, this is the intended behaviour. And just because
args(*) is always a proper list, most of the beware's
of "eval" don't apply here.

Thus,
  eval _puts $args
is perfectly right in this context!

(*): of course only when used that way.

PS: for completeness sake:
   In 8.5(alpha) this can also be: _puts {expand}$args
   but I can't assume people new to tcl use that already.
Received on Fri Dec 23 19:02:15 2005