Version 10 of A simple tcl script using Tcl Library

Updated 2014-08-22 10:14:58 by NickyQcode

http://naviserver.sourceforge.net/ns_logobig.gif

MainSource Code Downloads API Documentation Mailing Lists Bugs Developers


Tcl example

A simple config that enables the Tcl Library.

set        homedir               /usr/lib/naviserver

set        server_name           example1

set        address               192.168.1.130
set        port                  80


ns_section        "ns/server/${server_name}/modules"
   ns_param       nssock           ${homedir}/bin/nssock.so


ns_section        "ns/parameters"
   ns_param       home             $homedir


ns_section        "ns/servers"
   ns_param       $server_name     "Naviserver $server_name"


ns_section        "ns/server/${server_name}/fastpath"
   ns_param       pagedir          /var/www/example1.com/public_html


ns_section        "ns/server/${server_name}/module/nssock"
   ns_param       port             $port
   ns_param       address          $address


ns_section        "ns/server/${server_name}/tcl"
   ns_param       library          /var/www/example1.com/tcl


ns_section        "ns/module/nssock"
   ns_param       port             $port
   ns_param       address          $address
   ns_param       defaultserver    $server_name


ns_section        "ns/module/nssock/servers"
   ns_param       $server_name     example1

Example Usage

 alpha.co.uk/hello.html?foo=<value>

Output:

   Hello World. Value <value>

Note

If a Tcl directory is specified, the init.tcl file in that directory is sourced first (if it exists), and then all the remaining .tcl files are sourced alphabetically.