Skip to content

@Bhat-Gurunandan /app.psgi forked from hdp/app.psgi
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
# vim: ft=perl:
use strict;
use warnings;
use Plack::Builder;
use Plack::App::WrapCGI;
use Plack::App::URLMap;
builder {
enable 'Static',
path => qr{^/(images|skins|js)/},
root => './';
my $map = Plack::App::URLMap->new;
my @mount;
for my $cgi (<*.cgi>) {
my $app = eval { Plack::App::WrapCGI->new(script => $cgi)->to_app };
unless ($app) {
warn $@;
next;
}
my $wrapped = sub {
$Bugzilla::_request_cache = {};
Bugzilla::init_page();
my $res = $app->(@_);
Bugzilla::_cleanup();
return $res;
};
push @mount, [ '/' => $wrapped ] if $cgi eq 'index.cgi';
push @mount, [ "/$cgi" => $wrapped ];
}
$map->mount(@$_) for @mount;
$map->to_app;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.