Web Oriented Object Framework

User Guide (Version 0.5b4)

User Guide (Version 0.5b4)

Generating controller stubs

The wag script's url command can be used to generate the common boilerplate code that is contained in Woof! controllers as was illustrated in the Implementing controllers section of the Quick start chapter. The general form of the command is

tclsh scripts/wag.tcl url ?-excludeviews BOOLEAN? ?list of urls?

For each URL specified as an argument, the command will check if the controller and action exist, and if not, generate stubs corresponding to each URL, creating files, classes and method stubs as necessary. Moreover, if the -excludeviews option is not specified or specified as false, the command will also generate a stub for the main page section. Specifying true for this option will prevent generation of the view stubs. Note that stubs for other page sections are not generated as they are expected to be shared between actions, and even controllers.

The example below continues the one in the aforementioned chapter.

> tclsh scripts/wag.tcl url /math/add /math/multiply
Controller MathController:
         File app/controllers/math_controller.tcl will be modified.
         Class MathController will be modified.
         Methods to be added: multiply.
         View stubs to be added:
Do you want to continue? [YN] y
Created action MathController.multiply.

The above example specifies the generation of stubs for the add and multiply methods. As indicated in the output, the script discovers only the multiply stubs are missing and generates the same. The add method and view are not touched in any way.