NAME
Dancer::Plugin::Controller - interface between a model and view
SYNOPSIS
# YourApp.pm
use Dancer ':syntax';
use Dancer::Plugin::Controller;
get '/' => sub {
controller(
action => 'Index',
template => 'index',
layout => 'page_custom_layout', #
redirect_404 => '404.html' # redirect to if action method return undef
);
};
# YourApp::Action::Index.pm
sub main {
my ($class, $params) = @_; # $params - contains Dancer::params() and Dancer::vars()
...
return $template_params_hashref;
}
# config.yml
plugins:
"Controller":
# this is prefiix for module with implementation of action
action_prefix: 'MyActionPrefix' # default: 'Action'
AUTHOR
Mikhail N Bogdanov <mbogdanov at cpan.org>