NAME
Contentment::Request - Class responsible for managing incoming requests
DESCRIPTION
This class consumes an HTTP request and then presents the current request through the interface provided. Contentment is meant to target different web platforms (CGI, FastCGI, libwww-perl, mod_perl, etc.). Each of these present a different API for accessing the HTTP request information. This interface tries to simplify things by presenting a uniform request interface for all.
Rather than re-invent yet another interface to add to the list above, we'd rather just use an existing object. We use CGI to present this interface. It's not ideal because it also presents a lot of response functionality that should be found in Contentment::Response. However, it is the only interface that is both popular and works uniformly with nearly any target platform with very little effort. This also gives you additional functionality, such as HTML code generation, fill-in form generation, and some other tools that might also be useful in your code. However, the returning of response information is the job of Contentment::Response, so these features of CGI will remain unused (though, Contentment::Response probably uses them internally as they are quite handy).
METHODS
- $query = Contentment::Request->cgi
-
Retrieves a copy of the CGI object or undef if the request hasn't be initialized yet.
- $kind = Contentment::Request->final_kind
-
This method may be called to ask what kind of file the request wants returned. This involves calling the "Contentment::Request::final_kind" hook. The hook will be called at most once per request and the result will be cached here if this method is called more than once. If no handlers are set or none of the called handlers can identify the final kind, then the empty string (
""
) will be returned. - Contentment::Request->begin_cgi
-
This shouldn't be called outside of a Contentment handler method. It tells the handler to load the request from standard input and the environment.
This calls the
Contentment::Request::begin
hook. - Contemtent::Request->end_cgi
-
This shouldn't be called outside of a Contentment handler method. It calls the
Contentment::Request::end
hook. - Contentment::Request->begin_fast_cgi
-
This shouldn't be called outside of a Contentment handler method. It tells the handler to the load the FastCGI request.
This calls the
Contentment::Request::begin
hook. - Contentment::Request->end_fast_cgi
-
This shouldn't be called outside of a Contentment handler method. It calls the
Contentment::Request::end
hook.
HOOKS
- Contentment::Request::begin
-
These handlers are passed a single argument. This will be a copy of the just initialized CGI object.
- Contentment::Request::end
-
These handlers are passed a single argument. This will be a copy of the CGI object for the request.
- Contentment::Request::final_kind
-
These handlers are passed a single argument. This will be a copy of the CGI object for the request. These handlers should try to identify the kind of file the request wants rendered. The file "kind" is a bit of a nebulous idea, but is often a MIME Type or something similar and can be used by various plugins to figure out how to render the page. The first handler that returns a value other than
undef
forms the result of the hook. The rest of the handlers will not be called.
AUTHOR
Andrew Sterling Hanenkamp, <hanenkamp@cpan.org>
LICENSE AND COPYRIGHT
Copyright 2005 Andrew Sterling Hanenkamp. All Rights Reserved.
Contentment is licensed and distributed under the same terms as Perl itself.