ten::handle class
[scpubgit/TenDotTcl.git] / ten / ten.tcl
index a093a97..988915d 100644 (file)
@@ -241,7 +241,7 @@ snit::type ten::read_channel {
       }
     } else {
       if [llength $options(-on_line_call)] {
-        while {[llength [set line [gets $chan]]] > 0} {
+        while {[string length [set line [gets $chan]]] > 0} {
           eval [concat $options(-on_line_call) [ list $line ]]
         }
       }
@@ -249,4 +249,17 @@ snit::type ten::read_channel {
   }
 }
 
+snit::type ten::handle {
+  option -connection
+  option -id
+
+  method call {name args} {
+    return [[$self start $name {*}$args] await_get]
+  }
+
+  method start {name args} {
+    $options(-connection) send call [json::write string $options(-id)] 0 [json::write string $name] {*}$args
+  }
+}
+
 package provide ten 0.0.1