summaryrefslogtreecommitdiff
path: root/perl-cgi
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2010-10-22 23:36:54 +0200
committerJonas Smedegaard <dr@jones.dk>2010-10-22 23:36:54 +0200
commitbd681d813b3604b6cb5085c78e4980dfecedcb8c (patch)
tree9f3eab16d5d284d9c24c6601c7789418934fd16a /perl-cgi
parentb2325632bd7241d5d0a5ce5ed353d9f704fb9161 (diff)
Add FastCGI wrapper perl-cgi.
Diffstat (limited to 'perl-cgi')
-rwxr-xr-xperl-cgi25
1 files changed, 25 insertions, 0 deletions
diff --git a/perl-cgi b/perl-cgi
new file mode 100755
index 0000000..39dcc28
--- /dev/null
+++ b/perl-cgi
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+# Origin: http://philpep.org/pub/perl-cgi
+# Info: http://blog.philpep.org/post/Gitweb-fastcgi-lighttpd-et-FreeBSD
+
+use strict;
+use CGI::Fast;
+use Embed::Persistent;
+{
+ my $p = Embed::Persistent->new();
+ while (new CGI::Fast) {
+ my $filename = $ENV{SCRIPT_FILENAME};
+ my $package = $p->valid_package_name($filename);
+ my $mtime;
+ if ($p->cached($filename, $package, \$mtime))
+ {
+ eval {$package->handler;};
+ }
+ else
+ {
+ $p->eval_file($ENV{SCRIPT_FILENAME});
+ }
+ }
+}
+