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 next 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.
Re: Proof of concept: running Tcl scripts in Skylark [message #38532 is a reply to message #38527] Fri, 21 December 2012 21:37 Go to previous message
zsolt is currently offline  zsolt
Messages: 601
Registered: December 2005
Location: Budapest, Hungary
Contributor
Sorry, but this is not a good idea.
This is a very good way only to overload your server.
You should read some articles about CGI or something in the CGI vs FastCGI topic.
Previous Topic: Visualizing package structure
Next Topic: What's the best virtualization software for development?
Goto Forum:
  


Current Time: Sat Dec 14 09:54:40 CET 2019

Total time taken to generate the page: 0.01306 seconds