How to run *old* perl Kwiki on PSGI

How to run *old* perl Kwiki on PSGI

Saturday, 13 July 2013—subject to ongoing, unnanounced updates

Modern Perl Modern Perl at Powell’s, Modern Perl at Barnes and Noble, Modern Perl at Amazon.com, or download Modern Perl for free and then recommend it to your friends, write a great review, or otherwise spread the word.

I realize there is a dearth of documentation and exposition but here it is. If you found it you know what it is and why you might want it. Everyone else will just be like, WTF is wrong with Ashley? Why can’t he go back to threatening the President?

Well, I finally got around to sedition.me and sedition.im today so there’s some remote hope of something at some point. Some thing at somepoint. Fucking English.

The new version of Kwiki won’t install/run and has been broken on the CPAN for a long time. I have a decently large set of documents for a novel I never seem to write in the old one and it runs but needs CGI so won’t run on nginx (stock) and there aren’t enough hours in the day for apache anymore so–

#!/usr/bin/env perl
use strictures;
use Plack::Builder;
use Path::Class "file";
use File::Spec;
use Plack::App::WrapCGI;
use Plack::App::Directory;

my $psgi = file( File::Spec->rel2abs(__FILE__) );

my $STATIC = Plack::App::Directory
    ->new({ root => $psgi->parent })
    ->to_app;

my $KWIKI = Plack::App::WrapCGI
    ->new( script => file( $psgi->parent, "index.cgi" ) )
    ->to_app;

builder {
    enable "Rewrite", rules => sub {
        return 301 if s{^/index.cgi}{/kwiki};
        return 301 if s{^/?$}{/kwiki};
    };
    mount "/kwiki" => $KWIKI;
    mount "/" => $STATIC;
};

__DATA__