The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

OpenInteract - mod_perl handler to process all OpenInteract requests

DESCRIPTION

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)

    On error: die with error message.

  • 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' )

  • setup_cache( $R ): Create the cache object if we are supposed to use it

    Return: nothing

    On error: Send error information to user via send_html() then die with Apache return code (e.g., 'OK' )

  • parse_uri( $R ): Parse the URL and decide which conductor (UI) should take care of the request

    Return: nothing

    On error: Send error information to user via send_html() then die with Apache return code (e.g., 'OK' )

  • setup_cookies_and_session( $R ): Get the cookies and retrieve a session if it exists.

    Return: nothing

    On error: Send error information to user via send_html() then die with Apache return code (e.g., 'OK' )

  • 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'.

    Return: nothing

    On error: Send error information to user via send_html() then die with Apache return code (e.g., 'OK' )

  • setup_theme( $R ): Create the theme that is used throughout the request and stored in $R->{theme}.

    Return: nothing

    On error: Send error information to user via send_html() then die with Apache return code (e.g., 'OK' )

  • run_content_handler( $R ): Run the content handler which generates the full page.

    Return: nothing

    On error: Send error information to user via send_html() then die with Apache return code (e.g., 'OK' )

  • finish_cookies_and_session( $R ): Save the session and bake the cookies (put them into outgoing headers).

    Return: nothing

    On error: Send error information to user via send_html() then die with Apache return code (e.g., 'OK' )

  • 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.

NOTES

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...)

TO DO

Nothing known

BUGS

None known

COPYRIGHT

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.

AUTHORS

Chris Winters <chris@cwinters.com>