catch and eval
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

catch and eval

From: Himesh P. <himeshp@gmail.com>
Date: Tue Dec 20 2005 - 20:54:12 CET

I'm having trouble with eval'ing a statement whilst catching the eval:

This works like I want it to:
(bin) 10 % proc foo {args} {eval puts $args}
(bin) 11 % foo hi
hi
(bin) 12 % foo "hi there"
hi there

How can I fix this to work?
proc foo {args} {
    if [catch "eval puts $args" msg] {
        puts "error: $msg"
    }
}

% foo hi
hi
% foo "hi there"
error: can not find channel named "hi"
Received on Fri Dec 23 19:02:35 2005