Home | Wiki | OI 1.x Docs | OI 2.x Docs OI logo

NAME

OpenInteract::Request - Description and Contents of $R


OVERVIEW

The variable $R is the framework's request object. It acts as a container for other objects, repository for aliases all over the system and a place to call methods that deal with actions based on the configuration.

Some objects retrievable through $R:

You can also determine which class and method a module uses and find out what the class name of different SPOPS objects are.


GETTING TO $R

The $R variable is always present, one per Apache child. It gets cleaned up after every request, so there should be no memory leakage issues. We can do this because class for $R (OpenInteract::Request) is a subclass of Class::Singleton. This allows us to create the object once and have it always ``be there'' when we ask for it.

To ask for it, we simply need to do this:

 my $R = OpenInteract::Request->instance;

We can do this in any handler, in any object definition class or any utility class. If you like, you can include the OpenInteract::Request class specifically in your module, but it is not necessary.


RELATIONSHIP WITH THE STASH CLASS

The 'stash class' must be implmented on a per-application basis. Even though you can reach all the classes/objects through $R, $R actually passes off the request to the stash class, which is defined in the base configuration of your website (conf/base.conf).

We do this because you might want to run more than one application or website under the OpenInteract framework. It is feasible to do so by running each application self-contained, by running the mod_perl processes on a nonstandard port number and using a proxy scheme to pass requests back to the right set of processes. But this is wasteful.

Instead, we need to ensure that all application-specific information is kept in one place, and that $R knows how to get to it. Well, it does, so you don't have to worry about it.


METHODS RETURNING OBJECT OR CLASS NAME

All of the following are actually kept within a lexical variable in the stash class.


ACTION METHODS


HASH KEY PROPERTIES


ALIASES FOR METHODS DONE ELSEWHERE


GLOBAL INFORMATION

If your handler is a subclass of OpenInteract::SPOPS, you don't need to instantiate $R for a number of commonly used items.


AUTHORS

Chris Winters <chris@cwinters.com>


Home | Wiki | OI 1.x Docs | OI 2.x Docs
SourceForge Logo