CUSTOMIZING
Customizing you usage of Minima is quite straightforward once you understand how it works and a few PSGI concepts. If you haven't yet, check "How it works" in Minima.
Setup
The setup process can be completely skipped. If your goal is to create a custom app, load your configuration hash and create Minima::App yourself:
app.psgi
use Minima::App;
my $app = Minima::App->new(
environment => $env,
configuration => $config,
);
sub { $app->run }
Controllers
The main objective of a controller is to return a valid PSGI response. Minima::Controller is provided as a starting point for you to subclass and implement your logic as desired.
If you don't want to subclass it and are relying on Minima::App to instantiate and call your controller, you should note that by default it will pass two named arguments to your controller's new
method:
app => $self,
route => $m,
Depending on your implementation details (whether your controller is a class, package, or another type of object) you may want to use those arguments or not.
Arguments
app
-
A reference to the Minima::App instance which is initializing your controller.
route
-
The matched route as returned by Minima::Router.
As your controller is called last, remember to return a valid PSGI response and you're good to go.
Templating System
If you want to customize how Template Toolkit is used in Minima::View::HTML, check "Configuration" in Minima::View::HTML.
If you don't want to use Template Toolkit at all, just skip Minima::View::HTML. Your controller logic is solely responsible for calling it, so feel free to create your own views.
SEE ALSO
Minima, Minima::Manual::FAQ, perlclass.
AUTHOR
Cesar Tessarin, <cesar@tessarin.com.br>.
Written in September 2024.