From: Chris W. <la...@us...> - 2005-01-24 16:58:06
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14024 Modified Files: Controller.pm Log Message: doc: start with more helpful documentation about what a controller is and where you'd typically see it Index: Controller.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Controller.pm,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Controller.pm 26 Sep 2004 23:52:42 -0000 1.23 --- Controller.pm 24 Jan 2005 16:57:55 -0000 1.24 *************** *** 176,188 **** =head1 SYNOPSIS =head1 DESCRIPTION ! =head1 PROPERTIES ! B<request> - The current ! L<OpenInteract2::Request|OpenInteract2::Request> object ! B<response> - The current ! L<OpenInteract2::Response|OpenInteract2::Response> object B<type> - Type of controller --- 176,230 ---- =head1 SYNOPSIS + # In whatever adapter you're using you'll have this: + + my $controller = eval { + OpenInteract2::Controller->new( $request, $response ) + }; + if ( $@ ) { + $response->content( $@ ); + } + else { + $controller->execute; + } + $response->send; + =head1 DESCRIPTION ! Object that determines which action gets executed and what happens to ! its content. Typically its content gets placed into a larger template ! (see L<OpenInteract2::Controller::MainTemplate>), but you can perform ! other tasks as well. ! =head1 METHODS ! =head2 Class methods ! ! B<initialize_default_actions()> ! ! Class method called by ! L<OpenInteract2::Setup::InitializeControllers>. This finds and stores ! the actions under the 'action_info.none' and 'action_info.not_found' ! server configuration keys. These are returned by the context from the ! C<lookup_action_none()> and C<lookup_action_not_found()> methods. ! ! B<new( $request, $response )> ! ! Find the action to create from the data in C<$request>. Given the ! action, determine which controller implementation to use and ! instantiate an object of that type and return it. ! ! =head2 Object methods ! ! B<init()> ! ! Called with every request just before a controller is ! returned. Classes may override. ! ! B<execute()> ! ! Must be implemented by subclass. Should execute the main action and ! store its content (or its modified content) in the C<$response>. ! ! =head1 PROPERTIES B<type> - Type of controller *************** *** 192,199 **** B<initial_action> - The initial action used to generate content. - B<return_url> - URL to which the system should return after completing - various system tasks. It is a good idea to set this when possible so - when a user logs in she is returned to the same page. - =head1 COPYRIGHT --- 234,237 ---- |