Skip to content

Commit

Permalink
Add some path munging based on what Plack::App::URLMap does for mount…
Browse files Browse the repository at this point in the history
…ing the demo sites.
  • Loading branch information
perlDreamer committed Feb 18, 2012
1 parent 0337d6a commit 09dac7f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion wre/lib/WRE/WebguiDemo.pm
Expand Up @@ -38,7 +38,18 @@ sub call {
local $ENV{WEBGUI_CONFIG} = $webgui_config;
my $psgi = WebGUI::Paths->defaultPSGI;
my $app = Plack::Util::load_psgi($psgi);
return Plack::Util::run_app($app, $env);

my $orig_path_info = my $path = $env->{PATH_INFO};
my $orig_script_name = $env->{SCRIPT_NAME};

$path =~ s/\Q$id\E//;

$env->{PATH_INFO} = $path;
$env->{SCRIPT_NAME} .= $id;
return $self->response_cb($app->($env), sub {
$env->{PATH_INFO} = $orig_path_info;
$env->{SCRIPT_NAME} = $orig_script_name;
});
}
# Extras can be served from nginx
elsif ($r->uri->path eq "/create") {
Expand Down

0 comments on commit 09dac7f

Please sign in to comment.