Online Games Grumpy Unix Fart Contact Us

The Request object.

As alluded to earlier, we need some way of getting user input into your actions, while you could just fetch them directly, this is not advisable (what if you needed to change the CGI object?)

Since the controller hangs around after the request, we also needed a way of passing information from one method into another (or from internal, non-display actions of a view, stuff that is used internally)

We have two scratch pad areas for this, one called pad() and the other called param(). they are basically the same, except that param is intended to hold information that will ultimately be sent to the user (probably in HTML)

On the other hand, pad() is used internally to pass request-specific data around, thereby allowing the controller to remain persistent while still providing a basic container for request-specific data.

The request object has several methods, I won't go over them here (Just see the GenieMod::Request documentation for further details.

Sessions and CGI

Our implementation is optimized for CGI/FastCGI type applications, so, we have a cgi() object. This works out good, because other packages from CPAN typically expect you to be using a "CGI compatiple" object with them.

We also use CGI::Session for session management, however you may wish to write your own version of this as it is quite heavy.

The out() method.

In order to isolate output as much as possible, an application should never just print anything to standard output. (in fact, if it did, it would violate the whole idea of MVC..)

The request object therefore has an out() method (and if you wanted, you might give it an in() method as well, for now, we use CGI for that)

The out() handle of a request is kind of specialized, it is actually a wrapper around the IO::Handle style packages of perl. When output is sent, it will send headers, but, not until the first bit is sent out. In this manner, you can tweak the headers from within the view logic. (Such as showing an image instead of an HTML page)

It goes without saying, we never write to out() until the view stage. Methods of the controller should instead pass information by way of the param() method.

Send to a friend

[add]
Please enter code (Change Code)

Sending Message.