X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestMiddlewareFromConfig%2Ftestmiddlewarefromconfig.pl;fp=t%2Flib%2FTestMiddlewareFromConfig%2Ftestmiddlewarefromconfig.pl;h=4df352dada4327acc51f1c880636bce81f9c3155;hb=9da24147d3b6f1aafad911355dfc1ea93a99baf8;hp=0000000000000000000000000000000000000000;hpb=02352a283d954f8837277e40ba141b5c2c07af1b;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestMiddlewareFromConfig/testmiddlewarefromconfig.pl b/t/lib/TestMiddlewareFromConfig/testmiddlewarefromconfig.pl new file mode 100644 index 0000000..4df352d --- /dev/null +++ b/t/lib/TestMiddlewareFromConfig/testmiddlewarefromconfig.pl @@ -0,0 +1,28 @@ +use Plack::Middleware::Static; + +my $static = Plack::Middleware::Static->new( + path => qr{^/static/}, root => TestMiddlewareFromConfig->path_to('share')); + +my $conf = +{ + 'Controller::Root', { namespace => '' }, + 'psgi_middleware', [ + 'Head', + $static, + 'Static', { path => qr{^/static2/}, root => TestMiddlewareFromConfig->path_to('share') }, + 'Runtime', + '+TestMiddleware::Custom', { path => qr{^/static3/}, root => TestMiddlewareFromConfig->path_to('share') }, + sub { + my $app = shift; + return sub { + my $env = shift; + if($env->{PATH_INFO} =~m/forced/) { + Plack::App::File->new(file=>TestMiddlewareFromConfig->path_to(qw/share static forced.txt/)) + ->call($env); + } else { + return $app->($env); + } + }, + }, + + ], +};