#!/usr/bin/env perl use strict; use warnings; use File::Basename; use Plack::Builder; use Plack::App::CGIBin; my $basedir = dirname(__FILE__); builder { enable "Plack::Middleware::Static", path => qr{^/mt-static/}, root => $basedir; enable "Plack::Middleware::Static", path => sub { s!(^/[^/.]+(?:/[^.]*)?/?+$)!${1}/index.html! }, root => $basedir; enable "Plack::Middleware::Static", path => sub { s!(^/[^/.]+(?:/[^.]*))!${1}! }, root => $basedir; mount "/" => Plack::App::CGIBin->new( root => $basedir, exec_cb => sub { 1 } )->to_app; };