This is me trying to port my current Apache / Modperl site to Starman and you need to create app.psgi with different handlers for different file extensions. Somthing like in Apache:
<LocationMatch "(\.m|\.mh|\/)$"> SetHandler perl-script PerlHandler MyApp::Mhandler </LocationMatch> <LocationMatch "(\.p|\.ph)$"> SetHandler perl-script PerlHandler MyApp::Phandler </LocationMatch>
Now I have:
#app for handle .m and .mh my $Mapp = Some::PSGI->handler( sub { ... });
but how to use the builder?
builder {
Necessary "rules":
- if the request does not have an extension, or the request ends with '/'
- should be processed using
$Mapp
- if the request ends with some extension, then
.m
and .mh
must be handled by $Mapp
.p
and .ph
must be handled by $Papp
- all other files with extensions (e.g. .css.js.pdf.jpg ...) should be treated as static.
Of course, itβs much easier to put each static file in some tree, but the current application will be given, and now I only want to move it to Startman, refactoring later.
source share