#!../../src/xotclsh # $Id: Counter3.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $ array set opts {-pkgdir .}; array set opts $argv lappend auto_path $opts(-pkgdir) package require XOTcl 1; namespace import -force xotcl::* package require xotcl::actiweb::htmlPlace package require xotcl::actiweb::webDocument ### Instantiate an Html place with the name receiver HtmlPlace ::receiver -port 8093 -allowExit exit ### Define a class solely for counting Class Counter -parameter {{count 1}} Counter instproc increment {} { ;### counter method my incr count } ### Define a special WebCounter as a specialization of the Counter class Class WebCounter -superclass {Counter HtmlDocument} WebCounter instproc init args { ;### Constructor next my persistent count ;### make count variable persistent ::receiver exportObjs [self] ;### export the counter object my exportProcs increment ;### export increment method } WebCounter instproc default {} { ;### Method for updating HTML page set objName [string trimleft [self] :] return "The value in $objName is [my set count].