This is an example from the standard WebObjects distribution. It has been coverted to WOPerl.
The Visitors application displays the name of the most recent visitor and the total number of visitors to the page.
This is a simple example that's used in the WebScript documentation to explain basic concepts.
Like many WebObjects applications, Visitors uses the awake method. You use the awake method to prepare the page and its variables for use during the processing of the page. The awake method is the best place to initialize variables whose values remain static for the page's lifetime (such as a list of hyperlinks), or to modify variables whose values only change when the page is first accessed (such as a counter). The awake method is invoked once per transaction.
The Visitors application introduces global variables, and shows you how to access them from a component script. You can access global variables from any other script in an application by sending a message to the WOApplication object. For example, to set and return the values of a variable myVar from a component script, you'd use the syntax:
[WOApp myVar]; // return myVar [WOApp setLastVisitor:aValue]; // set value of myVar
Note that these "accessor methods" aren't defined anywhere. In WebScript, you can access script variables with such accessor methods without having to define them.