summaryrefslogtreecommitdiff
path: root/perl-cgi
diff options
context:
space:
mode:
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});
+ }
+ }
+}
+