Re: tcl cgi script
- From: "tom.rmadilo" <tom.rmadilo@xxxxxxxxx>
- Date: Tue, 2 Jun 2009 15:27:53 -0700 (PDT)
On Jun 2, 5:43 am, balaj...@xxxxxxxxx wrote:
Hi,
My goal is to setup a web server which will display home page. When
I click on a button in the homepage, server should execute some script
and return the result. So, I edited my index.html page in apache
server like the following:
root@autolite # cat index.html.en
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test from Balajee</title>
</head>
<!-- Background white, links blue (unvisited), navy (visited), red
(active) -->
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
vlink="#000080" alink="#FF0000">
<hr width="50%" size="8" />
<META http-equiv="Content-Script-Type" content="text/tcl">
<script type="text/tcl" src="test.cgi">
</script>
<h2 align="center">Welcome to Test Project</h2>
<p> Press Enter to continue... </p>
<FORM ACTION="./test.cgi" METHOD=POST>
<input type="submit" value="Submit" />
</FORM>
</body>
</html>
------------------------------------------------------------
And test.cgi is as follows:
root@autolite # cat test.cgi
#!/usr/bin/tclsh
puts "<html>"
puts "<head>"
puts "<body>"
puts "Content-type: text/html\n"
puts "<p> Script succeded </p>"
puts "</body>"
puts "</head>"
puts "</html>"
----------------------------------------------------------
But when I click a button in my broser, it is displaying like the
following:
#!/usr/bin/tclsh puts "" puts "" puts "" puts "Content-type: text/html
\n" puts "
Script succeded
" puts "" puts "" puts ""
-----------------------------------------------
I expected only "Script succeded" message in the redirected page.
But it is displaying like above.
What ewent wrong with this?
Don't use Tcl with Apache (there are no reasonable options here).
Also, your code makes no sense, you include an entire HTML document
inside another HTML document. I would suggest AOLserver, tclHttpd or
WUB, then tcpserver or inetd and some templating system if you need
dynamic content.
Also, your formatting of "puts" indicates that you might think that
Tcl suffers from the Java problem of handling new lines. You don't
have to separate each line of content in Tcl. One of those powerful
features you will never get with many languages.
.
- Follow-Ups:
- Re: tcl cgi script
- From: Koyama
- Re: tcl cgi script
- References:
- tcl cgi script
- From: balajee4
- tcl cgi script
- Prev by Date: Re: Is "lsort" broken for UTF-8? (8.6b1)
- Next by Date: Re: what the rule of backslash in tcl's regular expression
- Previous by thread: Re: tcl cgi script
- Next by thread: Re: tcl cgi script
- Index(es):
Relevant Pages
|