Tcl Scripts

Pure Tcl scripts let you do the heavy lifting to control your application. A sensible design pattern is to put most of your complex logic in these files, and then parse template files to display the results. This means that those who are creating the HTML files don't have to know much Tcl, and only need to call a few simple commands.

proc chat::model::getlines {user} {
    set sk [chat::model::getsock]
    puts $sk [list user $user cmd get msg ""]
    if { ! [eof $sk] } {
        gets $sk data
        return "$data"
    } else {
        error "Problem with socket"
    }
}

For instance scripts are useful when you want to have control of the http protocol and you are not transmitting text/html data. See the example regarding the file download or the xml messaging in Ajax development.

Design downloaded from free website templates.