#!../../src/xotclsh # $Id: Counter.xotcl,v 1.4 2006/09/27 08:12:39 neumann Exp $ #load /Users/neumann/src/xotcl-1.4.1/library/store/XOTclSdbm/libxotclsdbm1.2.dylib array set opts {-pkgdir .}; array set opts $argv lappend auto_path $opts(-pkgdir) package require XOTcl; namespace import -force xotcl::* package require xotcl::actiweb::htmlPlace package require xotcl::actiweb::webDocument ### Instantiate an Html place with the name receive and port 8090 HtmlPlace ::receiver -port 8090 -allowExit exit ### Define a class Counter as a special Html Document Class Counter -superclass HtmlDocument -parameter {{count 0}} Counter instproc init args { ;### Constructor next my persistent count ;### make count variable persistent ::receiver exportObjs [self] ;### export the counter object my exportProcs increment ;### export counter's increment method } Counter instproc default {} { ;### Method for updating HTML page set objName [string trimleft [self] :] return "The value in $objName is now: [my set count].