Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
lectus is currently offline  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.
 
Read Message
Read Message
Previous Topic: Visualizing package structure
Next Topic: What's the best virtualization software for development?
Goto Forum:
  


Current Time: Fri Mar 29 14:33:34 CET 2024

Total time taken to generate the page: 0.01212 seconds