Sponsoring The Perl Toolchain Summit 2025: Help make this important event another success Learn more

NAME

Kelp::Routes::Controller - Legacy routes and controller for Kelp

SYNOPSIS

# config.pl
# ---------
{
modules_init => {
Routes => {
router => 'Controller',
base => 'MyApp::Controller',
}
}
}
# MyApp/Controller.pm
# -------------------
use Kelp::Base 'MyApp';
sub shared_method {
my $self = shift; # $self is an instance of 'MyApp::Controller'
...
}
# MyApp/Controller/Users.pm
# -------------------------
use Kelp::Base 'MyApp::Controller';
sub read {
my $self = shift; # $self is an instance of 'MyApp::Controller::Users'
...
}

DESCRIPTION

This module is no longer needed, since Kelp::Routes handles reblessing by itself when configured with rebless. It's only here for backward compatibility and documentation purposes.

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.