yet another version
[catagits/Catalyst-Runtime.git] / t / lib / TestMiddlewareFromPlugin / testmiddlewarefromplugin.pl
1 use Plack::Middleware::Static;
2
3 my $static = Plack::Middleware::Static->new(
4   path => qr{^/static/}, root => TestMiddlewareFromPlugin->path_to('share'));
5
6 my $conf = +{
7   'Controller::Root', { namespace => '' },
8   'psgi_middleware', [
9     $static,
10     'Static', { path => qr{^/static2/}, root => TestMiddlewareFromPlugin->path_to('share') },
11     'Runtime',
12     '+TestMiddleware::Custom', { path => qr{^/static3/}, root => TestMiddlewareFromPlugin->path_to('share') },
13     sub {
14       my $app = shift;
15       return sub {
16         my $env = shift;
17         if($env->{PATH_INFO} =~m/forced/) {
18           Plack::App::File->new(file=>TestMiddlewareFromPlugin->path_to(qw/share static forced.txt/))
19             ->call($env);
20         } else {
21           return $app->($env);
22         }
23       },
24     },
25
26   ],
27 };