NAME

PlackX::MiddlewareStack - forms a complete PSGI application from various middlewares

SYNOPSIS

add a middleware:

use PlackX::MiddlewareStack;
my $builder = PlackX::MiddlewareStack->new;
$builder->add( 'Plack::Middleware::XFramework', { framework => 'Dog' } );
$builder->add('Plack::Middleware::Static');
my $psgi_handler =  sub { [ 200, [], ['ok'] ];};
my $handler = $builder->to_app($psgi_handler);

insert a middleware after middleware:

use PlackX::MiddlewareStack;
my $builder = PlackX::MiddlewareStack->new;
$builder->add( 'Plack::Middleware::XFramework', { framework => 'Dog' } );
$builder->add('Plack::Middleware::Static');
$builder->insert_after(
    'Plack::Middleware::Lint' => {},
    'Plack::Middleware::XFramework'
);
my $psgi_handler =  sub { [ 200, [], ['ok'] ];};
my $handler = $builder->to_app($psgi_handler);

insert a middleware before middleware:

   my $builder = PlackX::MiddlewareStack->new;
   $builder->add( 'Plack::Middleware::XFramework', { framework => 'Dog' } );
   $builder->add('Plack::Middleware::Static');
   $builder->insert_before(
       'Plack::Middleware::Lint' => {},
       'Plack::Middleware::XFramework'
   );
   my $psgi_handler =  sub { [ 200, [], ['ok'] ];};
   my $handler = $builder->to_app($psgi_handler);

DESCRIPTION

PlackX::MiddlewareStack combines various internal and external middlewares to form a complete Plack application.

SOURCE AVAILABILITY

This source is in Github:

http://github.com/dann/p5-plackx-middlewarestack

AUTHOR

Takatoshi Kitano <kitano.tk@gmail.com>

SEE ALSO

LICENSE

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