proc results catching

proc results catching

Post by Keit » Tue, 10 Nov 2009 15:51:32



How do I capture the result of a proc?

proc test { w } {
if {[regexp {\.} $w] == 1} {puts stdout "ok 123.4567"}
}


% test 123.4567
ok 123.4567

I want to put the "ok 123.4567" in a variable. I know I can do it in the
proc I'm just wondering if I can put it in a variable.


--
Best Regards, Keith
http://www.yqcomputer.com/ ~kilowattradio/
Tired of Google Groups?
http://www.yqcomputer.com/ ~kilowattradio/usenet.html
==================================================
How much does a surgical *** cost?
In 2001, the average charge for a surgical ***
at 10 weeksgestation was $468; but since most
*** s in the United States are performed at
low-cost clinics, women on average paid $372 for the
procedure.
How much does a medical *** cost? In 2001, the
average charge for a medical *** was $487.
Who pays for *** s?
Some 74% of women pay for *** s with their own
money; 13% of *** s are covered by Medicaid, and
13% are billed directly to private insurance. Some
women who pay for the procedure themselves may
receive insurance reimbur *** t later.
http://www.yqcomputer.com/ #ref31
 
 
 

proc results catching

Post by Donal K. F » Tue, 10 Nov 2009 18:28:50


The answer (assuming I've understood your question) is just this:

set var [test 123.4567]

But this is *really* basic stuff. I think you would be better off
starting with a tutorial rather than having us feed it to you
piecemeal:

http://www.yqcomputer.com/

Donal.

 
 
 

proc results catching

Post by Alexandre » Tue, 10 Nov 2009 19:16:36

On Nov 9, 10:28m, "Donal K. Fellows"



Also assuming you replace "puts" by "return" in the proc ;)

-A
 
 
 

proc results catching

Post by Keit » Tue, 10 Nov 2009 23:02:50

On Mon, 9 Nov 2009 01:28:50 -0800 (PST), "Donal K. Fellows"





Yes, I know I was just wondering if there was a trick to capture the
result of proc without using
set var ...
Thanks.

--
Best Regards, Keith
http://www.yqcomputer.com/ ~kilowattradio/
Tired of Google Groups?
http://www.yqcomputer.com/ ~kilowattradio/usenet.html
==================================================
How much does a surgical *** cost?
In 2001, the average charge for a surgical ***
at 10 weeksgestation was $468; but since most
*** s in the United States are performed at
low-cost clinics, women on average paid $372 for the
procedure.
How much does a medical *** cost? In 2001, the
average charge for a medical *** was $487.
Who pays for *** s?
Some 74% of women pay for *** s with their own
money; 13% of *** s are covered by Medicaid, and
13% are billed directly to private insurance. Some
women who pay for the procedure themselves may
receive insurance reimbur *** t later.
http://www.yqcomputer.com/ #ref31
 
 
 

proc results catching

Post by Gerald W. » Wed, 11 Nov 2009 00:36:04


Keith,

First off the result of the procedure as you defined it is the null string
-- puts returns the null string.

Second, the only way ou can use return value by passing it as value to
another procedure -- e.g. the second argument of sets.

Thirdly, are you asking really asking about how to "capture" data written to
stdout (or other channels like stderr)?


--
+------------------------------------------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
 
 
 

proc results catching

Post by Bruce Hart » Wed, 11 Nov 2009 08:54:31


actually, the proc itself would have to be updated to return the value
instead of writing it to stdout, for that assignment to be useful.

Bruce