]> git.sesse.net Git - remoteglot/blobdiff - www/app.psgi
Add the WWW directory. It is a mess currently, but...
[remoteglot] / www / app.psgi
diff --git a/www/app.psgi b/www/app.psgi
new file mode 100644 (file)
index 0000000..2666248
--- /dev/null
@@ -0,0 +1,28 @@
+#! /usr/bin/perl -T
+
+use strict;
+use warnings;
+use lib qw(./include);
+
+# These need to come before the Billig modules, so that exit is properly redirected.
+use CGI::PSGI;
+use CGI::Emulate::PSGI;
+use CGI::Compile;
+
+use Plack::Request;
+
+# Older versions of File::pushd (used by CGI::Compile) have a performance trap
+# that's hard to pin down. Warn about it.
+use File::pushd;
+if ($File::pushd::VERSION < 1.005) {
+       print STDERR "WARNING: You are using a version of File::pushd older than 1.005. This will work, but it has performance implications.\n";
+       print STDERR "Do not run in production!\n\n";
+}
+
+my $cgi = CGI::Compile->compile('/srv/analysis.sesse.net/analysis.pl');
+my $handler = CGI::Emulate::PSGI->handler($cgi);
+
+sub {
+       my $env = shift;
+       return &$handler($env);
+}