On 2012-07-22 16:55, Nagarajan Chinnasamy wrote:
Hello,

First of all, Thank You for your efforts of supporting Tcl under
Apache Server. This definitely eliminates the need for me to learn yet
another language to port my applications to web.

I just installed the latest version of Rivet (v2) on Debian 6 Squeeze
and could successfully browse through the example .rvt pages found on
Rivet Home Page.


This is a question on the pages written with .tcl extension. My
understanding was that the .tcl and .rvt extensions are mutually
exchangeable.  However, when I renamed a .rvt file to .tcl and
invoked it from the browser, I get errors on the page.


No, it doesn't work like that. Templates (.rvt) go into a parsing stage prior to being run within the ::request namespace, pure Tcl scripts (.tcl) are simply evaluated at the global namespace. That also implies HTML code has to be output explicitly using the 'puts' command.


.tcl file content (.rvt renamed to .tcl):
---------------------------------------------------

<? set hello_message "Hello world" ?>
<html>
  <head>
    <title><? puts $hello_message ?></title>
  </head>
  <body><?
    puts [html $hello_message pre b]
  ?></body>
</html>

view-source output from the browser (chrome):
---------------------------------------------------------------

<PRE>
<HR>invalid command name "<?"
    while executing
"<? set hello_message "Hello world" ?>"<HR>
<P><B>OUTPUT BUFFER:</B></P>
<? set hello_message "Hello world" ?>
<html>
  <head>
    <title><? puts $hello_message ?></title>
  </head>
  <body><?
    puts [html $hello_message pre b]
  ?></body>
</html>
</PRE>


in fact, the script was evaluated as pure Tcl, therefore the interpreter couldn't figure out what the "<?" was about


Content of rivet.conf file placed in mods-enabled folder is:

----------------------------------------------------------------------------

.rvt scripts are registered as different types of documents triggering the code that invokes the parser over them, the point of having 2 types registered was precisely that



 -- Massimo


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org

Reply via email to