Apache::App::Mercury::Controller - Example Controller class


This is simply a skeleton class which illustrates how a controller should interact with Apache::App::Mercury. Please look at the code to see how it should contruct and initialize an Apache::App::Mercury object, run its main content handler, and then cleanup non-persistent instance variables on completion. It does not illustrate object persistence; not for difficulty reasons, simply for lack of time. I highly recommend Apache::Session.

The below instance variables and accessors are required in your controller class for Apache::App::Mercury to operate properly.


  • $controller->{q}

    A CGI query object for the current http request.

  • $controller->{r}

    An Apache->request object for the current http request.


  • infomsg([$msg])

    Set or get a page-specific informational message. The controller should display this message in some prominent location on the resulting HTML page.

  • pagetitle([$title])

    Set or get the HTML page title.

  • pagebody([$body])

    Set or get the page body content.

  • get_time()

    Return the current unixtime, as returned by the Perl time() function. This accessor is used for time synchronization throughout the application, so your controller can keep a single time for each http request.

  • sitemark([$mark])

    Set or get a page-specific location mark, for logging purposes.


Adi Fairbank <>


Copyright (c) 2003 - Adi Fairbank

This software (Apache::App::Mercury and all related Perl modules under the Apache::App::Mercury namespace) is copyright Adi Fairbank.


July 19, 2003