Amon2-Lite
view release on metacpan or search on metacpan
"runtime" : {
"requires" : {
"Amon2" : "3.25",
"Amon2::Config::Simple" : "0",
"Amon2::Plugin::Web::CSRFDefender" : "0",
"Amon2::Setup::Flavor" : "0",
"Amon2::Web" : "0",
"Data::Section::Simple" : "0.03",
"Plack::App::File" : "0",
"Plack::Middleware::Session" : "0",
"Plack::Session::State::Cookie" : "0",
"Router::Simple" : "0.13",
"Text::Xslate" : "2.0010",
"Text::Xslate::Bridge::TT2Like" : "0.00010",
"parent" : "0",
"perl" : "5.008008"
}
},
"test" : {
"requires" : {
"App::Prove" : "0",
version: '0.13'
requires:
Amon2: '3.25'
Amon2::Config::Simple: '0'
Amon2::Plugin::Web::CSRFDefender: '0'
Amon2::Setup::Flavor: '0'
Amon2::Web: '0'
Data::Section::Simple: '0.03'
Plack::App::File: '0'
Plack::Middleware::Session: '0'
Plack::Session::State::Cookie: '0'
Router::Simple: '0.13'
Text::Xslate: '2.0010'
Text::Xslate::Bridge::TT2Like: '0.00010'
parent: '0'
perl: '5.008008'
resources:
bugtracker: https://github.com/tokuhirom/Amon2-Lite/issues
homepage: https://github.com/tokuhirom/Amon2-Lite
repository: git://github.com/tokuhirom/Amon2-Lite.git
version: '0.13'
- `__PACKAGE__->load_plugin($name, \%opts)`
Load a plugin to the context object.
- \[EXPERIMENTAL\] `__PACKAGE__->enable_session(%args)`
This method enables [Plack::Middleware::Session](https://metacpan.org/pod/Plack::Middleware::Session).
`%args` would be pass to enabled to `Plack::Middleware::Session->new`.
The default state class is [Plack::Session::State::Cookie](https://metacpan.org/pod/Plack::Session::State::Cookie), and store class is [Plack::Session::Store::File](https://metacpan.org/pod/Plack::Session::Store::File).
This option enables a response filter, that adds ` Cache-Control: private ` header.
- \[EXPERIMENTAL\] `__PACKAGE__->enable_middleware($klass, %args)`
__PACKAGE__->enable_middleware('Plack::Middleware::XFramework', framework => 'Amon2::Lite');
Enable the Plack middlewares.
- `__PACKAGE__->to_app(%args)`
requires 'Amon2', '3.25';
requires 'Amon2::Config::Simple';
requires 'Amon2::Setup::Flavor';
requires 'Amon2::Web';
requires 'Amon2::Plugin::Web::CSRFDefender';
requires 'Data::Section::Simple', '0.03';
requires 'parent';
requires 'Plack::App::File';
requires 'Plack::Middleware::Session';
requires 'Plack::Session::State::Cookie';
requires 'Router::Simple', '0.13';
requires 'Text::Xslate', '2.0010'; # 2.0010+ gets Perl 5.18+ compatibility
requires 'Text::Xslate::Bridge::TT2Like', '0.00010';
on test => sub {
requires 'Test::More', '0.98';
requires 'Test::Requires';
requires 'App::Prove';
requires 'File::Temp';
lib/Amon2/Lite.pm view on Meta::CPAN
return $app;
};
*{"${base_class}::enable_middleware"} = sub {
my ($class, $klass, %args) = @_;
push @{"${caller}::_MIDDLEWARES"}, [$klass, \%args];
};
*{"${base_class}::enable_session"} = sub {
my ($class, %args) = @_;
$args{state} ||= do {
require Plack::Session::State::Cookie;
Plack::Session::State::Cookie->new(httponly => 1); # for security
};
require Plack::Middleware::Session;
$class->enable_middleware('Plack::Middleware::Session', %args);
$class->add_trigger(AFTER_DISPATCH => sub {
my ($c, $res) = @_;
$res->header('Cache-Control' => 'private');
});
};
*{"$caller\::router"} = sub { $router };
lib/Amon2/Lite.pm view on Meta::CPAN
=item C<< __PACKAGE__->load_plugin($name, \%opts) >>
Load a plugin to the context object.
=item [EXPERIMENTAL] C<< __PACKAGE__->enable_session(%args) >>
This method enables L<Plack::Middleware::Session>.
C<< %args >> would be pass to enabled to C<< Plack::Middleware::Session->new >>.
The default state class is L<Plack::Session::State::Cookie>, and store class is L<Plack::Session::Store::File>.
This option enables a response filter, that adds C< Cache-Control: private > header.
=item [EXPERIMENTAL] C<< __PACKAGE__->enable_middleware($klass, %args) >>
__PACKAGE__->enable_middleware('Plack::Middleware::XFramework', framework => 'Amon2::Lite');
Enable the Plack middlewares.
=item C<< __PACKAGE__->to_app(%args) >>
( run in 0.530 second using v1.01-cache-2.11-cpan-e9199f4ba4c )