yet another web application framework
Perl Other
Latest commit 0595646 Apr 8, 2016 @tokuhirom Checking in changes prior to tagging of version 6.13.
Changelog diff is:

diff --git a/Changes b/Changes
index d4dfe50..93b9f9e 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,8 @@ Revision history for Perl module Amon2

 {{$NEXT}}

+6.13 2016-04-08T09:57:09Z
+
 	commit df41f39
 	Author: Koichi SATOH <r.sekia@gmail.com>
 	Date:   Fri Apr 8 13:58:57 2016 +0900
Permalink
Failed to load latest commit information.
author bundle bootstrap 3.3.5 Jun 17, 2015
eg Checking in changes prior to tagging of version 6.13. Apr 8, 2016
lib
script
share/flavor Checking in changes prior to tagging of version 6.05. Aug 1, 2014
t
xt
.gitignore
.proverc
.travis.yml install EU::PXS first for broken perl 5.14.0 Jan 8, 2014
Build.PL
Changes
LICENSE Checking in changes prior to tagging of version 3.80. Apr 21, 2013
META.json
README.md
README.mkdn
TODO updated todo list Oct 7, 2011
cpanfile fixed deps Jul 31, 2014
minil.toml Added travis badge! Oct 20, 2013

README.md

Build Status

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.

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:

    __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
    
  • MyApp->load_config()

    You can get a configuration hashref from config/$ENV{PLACK_ENV}.pl. You can override this method for customizing configuration loading method.

  • MyApp->add_config()

    DEPRECATED.

  • MyApp->debug_mode()

    ((EXPERIMENTAL))

    This method returns a boolean value. It returns true when $ENV{AMON2_DEBUG} is true value, false otherwise.

    You can override this method if you need.

PROJECT LOCAL MODE

THIS MODE IS HIGHLY EXPERIMENTAL

Normally, Amon2's context is stored in a global variable.

This module makes the context to project local.

It means, normally context class using Amon2 use $Amon2::CONTEXT in each project, but context class using "PROJECT LOCAL MODE" use $MyApp::CONTEXT.

It means you can't use code depend <Amon2-context>> and <Amon2-context>> under this mode.>

NOTES ABOUT create_request

Older Amon2::Web::Request has only 1 argument like following, it uses Amon2->context to get encoding:

sub create_request {
    my ($class, $env) = @_;
    Amon2::Web::Request->new($env);
}

If you want to use "PROJECT LOCAL MODE", you need to pass class name of context class, as following:

sub create_request {
    my ($class, $env) = @_;
    Amon2::Web::Request->new($env, $class);
}

HOW DO I ENABLE PROJECT LOCAL MODE?

MyApp-make_local_context() > turns on the project local mode.

There is no way to revert it, thanks.

METHODS

This module inserts 3 methods to your context class.

  • MyApp->context()

    Shorthand for $MyApp::CONTEXT

  • MyApp->set_context($context)

    It's the same as:

    $MyApp::CONTEXT = $context
    
  • my $guard = MyApp->context_guard()

    Create new context guard class.

    It's the same as:

    Amon2::ContextGuard->new(shift, \$MyApp::CONTEXT);
    

DOCUMENTS

More complicated documents are available on http://amon.64p.org/

SUPPORTS

#amon at irc.perl.org is also available.

AUTHOR

Tokuhiro Matsuno tokuhirom@gmail.com

CONTRIBUTORS

  • noblejasper
  • hiratara
  • s-aska
  • Kentaro Kuribayashi
  • Yuki Ibe
  • mattn
  • Masahiro Nagano
  • rightgo09
  • karupanerura
  • hatyuki
  • Keiji, Yoshimi
  • Nishibayashi Takuji
  • dragon3
  • Fuji, Goro
  • issm
  • hisaichi5518
  • Adrian
  • Fuji, Goro
  • ITO Nobuaki
  • Geraud CONTINSOUZAS
  • Syohei YOSHIDA
  • magnolia
  • Katsuhiro Konishi

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.