Home » Community » Coffee corner » Proof of concept: running Tcl scripts in Skylark 
	
		
		
			| Proof of concept: running Tcl scripts in Skylark [message #38527] | 
			Fri, 21 December 2012 16:59   | 
		 
		
			
				
				
				
					
						  
						lectus
						 Messages: 329 Registered: September 2006  Location: Brazil
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		1) Download tclkitsh (Single exe Tcl runtime, without Tk) from http://code.google.com/p/tclkit/downloads/list 
 
2) Create a folder /tcl-scripts in the app executable path. 
 
3) Add this handler to your Skylark App: 
SKYLARK(CGITcl, "/tcl/*")
{
	String cmd = "tclkitsh.exe tcl-scripts/" + http[0];
	LocalProcess p(cmd);
	
	String buffer="";
	String data;
	
	while(p.Read(data))
		buffer += data;
	
	if(p.IsRunning())
		p.Kill();
	http << buffer;
}
 
 
4) Add links to .tcl files in your .witz files: 
<a href="/tcl/time.tcl">Time server</a>  
 
5) Write Tcl code: 
tcl-scripts/time.tcl 
puts "<html><head><title>Tiny CGI time server</title></head>
 <body><h1>Time server</h1>
 Time now is: [clock format [clock seconds]]<br>
 <hr>
 <a href=\"http://127.0.0.1:8001/cgi_test\">Index</a>
 </body></html>"
  
 
Explanation of the code above: the command [clock seconds] returns the time. And [clock format] formats the time in human readable form. 
 
I suggest using environment variables to return data. 
 
This can be adapted to Python, Perl, Lua, whatever.
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 15:08:08 CET 2025 
 Total time taken to generate the page: 0.05245 seconds 
 |