NAME
Kelp::Routes::Controller - Routes and controller for Kelp
SYNOPSIS
# config.pl
# ---------
{
modules_init => {
Routes => {
base => 'MyApp::Controller',
router => 'Controller'
}
}
}
# MyApp/Controller.pm
# -------------------
package MyApp::Controller;
use Kelp::Base 'MyApp';
sub shared_method {
my $self = shift; # $self is an instance of 'MyApp::Controller'
...
}
# MyApp/Controller/Users.pm
# -------------------------
package MyApp::Controller::Users;
use Kelp::Base 'MyApp::Controller';
my read {
my $self = shift; # $self is an instance of 'MyApp::Controller::Users'
...
}
DESCRIPTION
This router module reblesses a Kelp application into its own controller class. This allows you to structure your web application in a classic object oriented fashion, having $self
an instance to the current class rather than the main web application.
You must create a main controller class which inherits from Kelp. Each subsequent class can inherit from this class, taking advantage of any common functionality.