summaryrefslogtreecommitdiff
path: root/perl-cgi
blob: 39dcc28d1ed11bae7289a38fdc75767c16a88155 (plain)
  1. #!/usr/bin/perl
  2. # Origin: http://philpep.org/pub/perl-cgi
  3. # Info: http://blog.philpep.org/post/Gitweb-fastcgi-lighttpd-et-FreeBSD
  4. use strict;
  5. use CGI::Fast;
  6. use Embed::Persistent;
  7. {
  8. my $p = Embed::Persistent->new();
  9. while (new CGI::Fast) {
  10. my $filename = $ENV{SCRIPT_FILENAME};
  11. my $package = $p->valid_package_name($filename);
  12. my $mtime;
  13. if ($p->cached($filename, $package, \$mtime))
  14. {
  15. eval {$package->handler;};
  16. }
  17. else
  18. {
  19. $p->eval_file($ENV{SCRIPT_FILENAME});
  20. }
  21. }
  22. }