Amon2

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

[![Build Status](https://travis-ci.org/tokuhirom/Amon.svg?branch=master)](https://travis-ci.org/tokuhirom/Amon)
# NAME

Amon2 - lightweight web application framework

# SYNOPSIS

    package MyApp;
    use parent qw/Amon2/;
    use Amon2::Config::Simple;
    sub load_config { Amon2::Config::Simple->load(shift) }

# DESCRIPTION

Amon2 is simple, readable, extensible, **STABLE**, **FAST** web application framework based on [Plack](https://metacpan.org/pod/Plack).

# METHODS

## CLASS METHODS for `Amon2` class

- my $c = MyApp->context();

    Get the context object.

- MyApp->set\_context($c)

    Set your context object(INTERNAL USE ONLY).

# CLASS METHODS for inherited class

- `MyApp->config()`

    This method returns configuration information. It is generated by `MyApp->load_config()`.

- `MyApp->mode_name()`

    This is a mode name for Amon2. The default implementation of this method is:

        sub mode_name { $ENV{PLACK_ENV} }

    You can override this method if you want to determine the mode by other method.

- `MyApp->new()`

    Create new context object.

- `MyApp->bootstrap()`

        my $c = MyApp->bootstrap();

    Create new context object and set it to global context. When you are writing CLI script, setup the global context object by this method.

- `MyApp->base_dir()`

    This method returns the application base directory.

- `MyApp->load_plugin($module_name[, \%config])`

    This method loads the plugin for the application.

    _$module\_name_ package name of the plugin. You can write it as two form like [DBIx::Class](https://metacpan.org/pod/DBIx%3A%3AClass):

        __PACKAGE__->load_plugin("Web::CSRFDefender");    # => loads Amon2::Plugin::Web::CSRFDefender

    If you want to load a plugin in your own name space, use the '+' character before a package name, like following:
        \_\_PACKAGE\_\_->load\_plugin("+MyApp::Plugin::Foo"); # => loads MyApp::Plugin::Foo

- `MyApp->load_plugins($module_name[, \%config ], ...)`

    Load multiple plugins at one time.

    If you want to load a plugin in your own name space, use the '+' character before a package name like following:

        __PACKAGE__->load_plugins("+MyApp::Plugin::Foo"); # => loads MyApp::Plugin::Foo



( run in 0.494 second using v1.01-cache-2.11-cpan-df04353d9ac )