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

MojoX::ConfigAppStart - Start a Mojolicious application with Config::App

VERSION

version 1.03

SYNOPSIS

# look for "mojo_app_lib" value in Config::App configuration
use MojoX::ConfigAppStart;
MojoX::ConfigAppStart->start;

# provide explicit Mojolicious application control library on start call
use MojoX::ConfigAppStart;
MojoX::ConfigAppStart->start('Application::Control');

# provide explicit Mojolicious application control library on use call
use MojoX::ConfigAppStart 'Application::Control';
MojoX::ConfigAppStart->start;

DESCRIPTION

The goal of this module is to provide a simplified way to spin up Mojolicious applications based on settings from a Config::App configuration system.

If you have either MOJO_MODE or PLACK_ENV defined as enviornment variables, the value will be used as the Config::App enviornment definition. If not defined at all, then "development" will be used. What this means in practice is that from the commandline, calling morbo or hypnotoad typically does what you want and expect.

Effective Equivalence

The following is effectively equivalent to using this module, except that the Application::Control library is derived:

BEGIN {
    $ENV{CONFIGAPPENV} = $ENV{MOJO_MODE} || $ENV{PLACK_ENV} || 'development';
}

use Config::App;
use Mojolicious::Commands;

Mojolicious::Commands->start_app('Application::Control');

METHODS

The following is the only method provided:

start

The start() method calls Mojolicious::Commands's start_app() and returns the result.

MojoX::ConfigAppStart->start;

It can optionally be provided an explicit module name:

MojoX::ConfigAppStart->start('Application::Control');

SEE ALSO

You can look for additional information at:

AUTHOR

Gryphon Shafer <gryphon@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018-2050 by Gryphon Shafer.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)