diff --git a/lib/Plack/App/URLMap.pm b/lib/Plack/App/URLMap.pm index 298da8156..c284ff325 100644 --- a/lib/Plack/App/URLMap.pm +++ b/lib/Plack/App/URLMap.pm @@ -103,8 +103,9 @@ Plack::App::URLMap - Map multiple apps in different paths Plack::App::URLMap is a PSGI application that can dispatch multiple applications based on URL path and hostnames (a.k.a "virtual hosting") -and takes care of rewriting C and C. This -module is inspired by Rack::URLMap. +and takes care of rewriting C and C (See +L for details). This module is inspired by +Rack::URLMap. =head1 METHODS @@ -127,7 +128,8 @@ Mapping URL with host names is also possible, and in that case the URL mapping works like a virtual host. Mappings will nest. If $app is already mapped to C it will -match a request for C but not C. +match a request for C but not C. See L for more details. =item mount @@ -150,6 +152,34 @@ You can set the environment variable C to see how this application matches with the incoming request host names and paths. +=head1 HOW THIS WORKS + +This application works by I C>SCRIPT_NAME> and C +before dispatching the incoming request to the relocated +applications. + +So if you have a Wiki application that takes C and C +and makes a PSGI application C<$wiki_app> out of it, using one of +supported web frameworks, you can put the whole application under +C by: + + # MyWikiApp looks at PATH_INFO and handles /index and /page/* + my $wiki_app = sub { MyWikiApp->run(@_) }; + + use Plack::App::URLMap; + my $app = Plack::App::URLMap->new; + $app->mount("/wiki" => $wiki_app); + +When a request comes in with C set to C, +the URLMap application C<$app> strips the C part from +C and B that to C. + +That way, if the C<$app> is mounted under the root +(i.e. C is C<"">) with standalone web servers like +L, C is now locally set to C and +C is changed to C when C<$wiki_app> is being +called. + =head1 AUTHOR Tatsuhiko Miyagawa