[go: up one dir, main page]

Controller( $catalyst, @pathArguments )

This method handles a request.

controller_dispatch( @args )

controller_dispatch performs the standard RapidApp dispatch processing for a Module.

  • If the first argument names an action, the action is executed.

  • If the first argument names a sub-module, the processing is passed to the sub-module.

  • If the first argument does not match anything, then the default action is called, if specified, otherwise a 404 is returned to the user.

  • If there are no arguments, and the client was not requesting JSON, the viewport is executed.

  • Else, content is called, and its return value is passed to render_data.

process_action( $actionName, [optional @args] )

This routine handles the execution of a selected action. The action must exist. For actions that map to coderefs, the coderef is executed. For actions that map to strings, a method of that name is called on $self.

render_data( $data )

This is a very DWIM sort of routine that takes its parameter (likely the return value of content or an action) and picks an appropriate view for it, possibly ignoring it altogether.

  • If the action generated a body, no view is needed, and the parameter is ignored.

  • If the action chose its own view, no further processing is done, and the parameter is returned.

  • If the controller is configured to render json (the default) and the parameter isn't blacklisted in no_json_ref_types, and the parameter isn't a plain string, the RapidApp::JSON view is chosen. The parameter is returned (as-is) to get passed back to TopController who passes it to the view.

  • Else, the data is treated as an explicit string for the body. The body is assigned, and returned.

set_response_callback

examples

$self->set_response_callback( 'Ext.ux.MyFunc' );

$self->set_response_callback( alert => 'foo!' );

$self->set_response_callback( 'Ext.Msg.alert' => ( 'A message!!', 'this is awesome!!' ) );

my $func = RapidApp::JSONFunc->new( 
  raw => 1, 
  func => 'function(){ console.log("anon!!"); console.dir(this.response); }'
);
$self->response_callback_scoped(1);
$self->set_response_callback( 
  $func => ( "arg1",{ key_in_arg2 => 'blah!!!' },'arg3',\1  ) 
);

NAME

RapidApp::Module - Base class for RapidApp Modules

SYNOPSIS

package MyApp::Module::MyModule;
use Moose;
extends 'RapidApp::Module';

DESCRIPTION

This is the base class for all RapidApp Modules. Documentation still TDB...

SEE ALSO

AUTHOR

Henry Van Styn <vanstyn@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by IntelliTree Solutions llc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.