The Tcl and PHP Primer Tutorial was a foretaste to today’s calculator web application that …
- uses PHP as a frontend and (HTML) form navigation destination …
- connects to backend via PHP exec …
- uses TCL as backend … via …
exec("tclsh calculator.tcl < calculator.txt | tail -1 > calculator.out");
Crucial to the TCL’s backend role is TCL’s expr command, as a determinant regarding what today’s calculator is capable of.
Here is a link to some downloadable PHP source code calculator.php supervising calculator.tcl TCL source code, and here is a live run link.
Previous relevant Tcl and PHP Primer Tutorial … http://www.tcl.tk/software/tcltk/ is shown below.
Have you heard of Tcl/Tk? Think maybe you could introduce yourself to it with Tcl/Tk So Brilliant (but where do you start?) Primer Tutorial as shown below.
The Tcl in Tcl/Tk refers to the scripting side of things, while the Tk is a GUI framework. On some (maybe lots) of Linux or unix web servers, such as the one for this domain here at www.rjmprogramming.com.au Tcl scripting is available and that means Tcl could be used by PHP, as a server side language to use the exec method to ask something of Tcl and get something back, half of which is the arrangement we’d like to have when feeding our babies.
Today we write a webpage for finding the Country of Origin of a designated URL where PHP supervises Tcl:
- ask for a URL in PHP,
- send that to the same PHP with a different call …
- and use PHP exec method to send a Tcl commend line command to Tclsh and output this to a file known by the PHP,
- get the PHP to read the file of step 3. and send that information in a modified call of this same PHP,
- write out the Tcl based findings to the webpage in PHP,
- ask for a URL in PHP
Here is a link to some downloadable PHP source code domain.php supervising domain.tcl TCL source code, and here is a live run link.
Thanks to:
- Flow control in Tcl
- [tcsh] $argv loses quotes, messes argument grouping up
- Using Variables in Associative Arrays
- Quoting and Command-Line Parameters
- Exploring Expect: A Tcl-based Toolkit for Automating Interactive Programs
- Split a string into a proper Tcl list
- Country code top-level domain
- Top Level Domain Names and Country Codes
- Tcl – Strings
Previous relevant Tcl/Tk So Brilliant (but where do you start?) Primer Tutorial is shown below.
Have you heard of Tcl/Tk?
Tcl/Tk is open source (based on a BSD-style license), so you can use it and modify it virtually any way you want, including for commercial uses.
With Tcl/Tk have used in conjunction with C++ and Python (look out for Tkinter).
Use it for Games Programming (it makes pretty cute GUIs … you may disagree?!) and it used to work back at Mac OS X 10.5.8/XCode 3.0 (am going to try Mac OS X 10.7.5 … any advice anywhere?) and had it going on Windows XP with Visual Studio Express as well. It has a lot of cross-platform strengths.
Think Tcl/Tk is really really good.
In this primer tutorial you can see a Draw Poker game as an XCode project, see it Build and in action, then see how to arrange for *.dmg Package Distribution via Package Manager.
Link to Tcl/Tk website … Home of Tcl/Tk … where quote up the top resides
Link to Tcl/Tk jobs done … Tcl/Tk jobs done … personal experience
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
One Response to Tcl and PHP Calculator Tutorial