OpenInteract - mod_perl handler to process all OpenInteract requests
This documentation is for the OpenInteract Apache content handler. For general information about OpenInteract, see OpenInteract::Intro.
This content handler creates the OpenInteract::Request object and farms requests out to all the relevant handlers -- cookies, session, authentication, themes, etc.
We walk through a number of class methods here. They are probably self-evident by checking out the code, but just to be on the safe side.
setup_request( $apache ): Retrieve the StashClass from the Apache config, grab the Config object from the StashClass, and create/retrieve the OpenInteract::Request object.
Return: $R (an OpenInteract::Request)
$R
On error: die with error message.
die
setup_apache( $R, $apache ): Create the Apache::Request object and store it in $R. We reuse this object throughout the request so we should not have any issues with POST values being empty on a second read.
Return: nothing
On error: Send error information to user via send_html() then die with Apache return code (e.g., 'OK' )
send_html()
setup_cache( $R ): Create the cache object if we are supposed to use it
parse_uri( $R ): Parse the URL and decide which conductor (UI) should take care of the request
setup_cookies_and_session( $R ): Get the cookies and retrieve a session if it exists.
setup_authentication( $R ): Authenticate the user and get the groups the user belongs to, plus set for this request whether the user is an administrator. Also run the custom authentication handler as defined in the server configuration.
If the 'login.required' server configuration key is a true value we ensure that there's a legitimate user logged in. If there's no login we call the 'url_requires_login()' class method passing the requested URL and the arrayref of URLs in the 'login.required_skip' server configuration key.
If that method indicates that the URL does require a login we call the class method 'required_login_not_found()', passing $R as the sole argument. That method is responsible for resetting the URL in the request to that specified in 'login.required_url'.
setup_theme( $R ): Create the theme that is used throughout the request and stored in $R->{theme}.
$R->{theme}
run_content_handler( $R ): Run the content handler which generates the full page.
finish_cookies_and_session( $R ): Save the session and bake the cookies (put them into outgoing headers).
send_html( $apache, $page, $R ): Send the http header(s) and HTML for the page content.
send_static_file( $R ): If a static file is specified (if a person requests a PDF file), then send it.
cleanup( $R ): Cleanup the request object and stash class.
Since all of the above are class methods, you can subclass OpenInteract so you override one or more of the above methods.
If you get an error with something like:
Can't locate object method "cookies" via package "OpenInteract::Request" at /usr/lib/perl5/site_perl/5.6.1/OpenInteract.pm line 226.
This likely means that the OpenInteract::Request::setup_aliases() wasn't run. Typically this is run in the PerlChildInitHandler when an Apache child is first created. This points to a larger problem if it is not run. (What exactly is that larger problem? Still working on that...)
OpenInteract::Request::setup_aliases()
Nothing known
None known
Copyright (c) 2001-2002 intes.net, inc.. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Chris Winters <chris@cwinters.com>
To install OpenInteract, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenInteract
CPAN shell
perl -MCPAN -e shell install OpenInteract
For more information on module installation, please visit the detailed CPAN module installation guide.