The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Minima::Setup -- Setup a Minima web application

SYNOPSIS

# app.psgi
use Minima::Setup 'config.pl';
\&Minima::Setup::init;

DESCRIPTION

This package is dedicated to the initial setup of a web application using Minima. It provides the init subroutine which runs the app and can be passed (as a reference) as the starting subroutine of a PSGI application.

CONFIG FILE

A single argument may be optionally passed when use-ing this module, representing the configuration file. Minima::Setup will attempt to read this file and use it to initialize Minima::App.

By default, the configuration file is assumed to be etc/config.pl. If this file exists and no other location is provided, it will be used. If nothing was passed and no file exists at the default location, the app will be loaded with an empty configuration hash.

SUBROUTINES

init

sub init ($env)

Receives the Plack environment and runs the Minima::App object. A reference to this subroutine can be passed as the starting point of the PSGI application.

test

sub test ()

Creates and returns Plack::Test object with the current Minima::App. See Minima::Manual::Testing for more on testing.

TESTING

For testing purposes, you may want to have Minima::Setup load the configuration and create a Minima::App. You can access a reference to the created app (after importing the module) with Minima::Setup::app.

SEE ALSO

Minima, Plack.

AUTHOR

Cesar Tessarin, <cesar@tessarin.com.br>.

Written in September 2024.