Skip to content

Instantly share code, notes, and snippets.

@audreyt
Forked from fujiwara/gist:732822
Created February 19, 2011 00:31
Show Gist options
  • Save audreyt/834671 to your computer and use it in GitHub Desktop.
Save audreyt/834671 to your computer and use it in GitHub Desktop.
mt.psgi (for both Melody and MT5)
#!/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;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment