On Sun, 9 May 2010, Eric Wong wrote: > Jakub Narebski <jnareb@xxxxxxxxx> wrote: >> On Fri, 7 May 2010, Jakub Narebski wrote: >> >>> The alternate solution would be to add gitweb.fcgi wrapper, like e.g.: >>> in the following patch by Eric Wong >>> >>> "[PATCH 1/2] gitweb: add a simple wrapper for FCGI support" >>> http://thread.gmane.org/gmane.comp.version-control.git/35920/focus=35921 >>> >>> which was part of the "[0/2 PATCH] FastCGI and nginx support for gitweb" >>> series. (Note that the patch does 'do $gitweb_cgi;' without checking for >>> errors, see the bottom of `perldoc -f do` documentation on how it should >>> be done). >> >> I think a better solution here would be to use CGI::Compile instead >> of 'do $gitweb_cgi;'. > > Possibly, now that CGI::Compile exists. Can that be used with a > standalone Perl HTTP server? Yes, it can. CGI::Compile is used for example by CGI::Emulate::PSGI, and you can run PSGI app on standalone Perl web server (pure Perl HTTP::Server::PSGI, or HTTP::Server::Simple::PSGI which in turn uses HTTP::Server::Simple, or Starman, or Twiggy, or Perlbal). CGI::Compile just compiles given CGI script into a subroutine, which can be called many times in a persistent web environment like FastCGI. > > It's 2010 now and I have long abandoned FastCGI in favor of using HTTP > to the application backends. In my experience, having only one > plain-text protocol for both frontend web serving and backend > application RPC makes development/monitoring/testing much easier. Do you mean here standalone web server in the language of web application? > > I just use Ruby WEBrick nowadays for any instaweb instances I run to > share with a few cow-orkers. I do a reasonable amount of development in > Ruby, so it's always installed and ready for me. It would be nice if > there were something standalone and as ubiquitous as WEBrick in the Perl > world. Modern Perl has PSGI/Plack (http://plackperl.org), which was inspired by Python's WSGI and Ruby's Rack. The Plack reference implementation includes 'plackup' tool (inspired by Ruby's 'rackup'), which can be used to run a PSGI application on any supported web server (with Plackup's adapter), like HTTP::Server::PSGI, HTTP::Server::Simple::PSGI, etc. PSGI/Plack goal is to be THE superglue interface between perl web application frameworks and web servers. P.S. BTW, I use the following wrapper for gitweb.cgi (in gitweb.psgi) -- 8< -- #!/usr/bin/env plackup # gitweb - simple web interface to track changes in git repositories # PSGI wrapper (see http://plackperl.org) use strict; use warnings; use Plack::Builder; use Plack::App::WrapCGI; use CGI::Emulate::PSGI 0.07; # minimum version required to work use File::Spec; # __DIR__ is taken from Dir::Self __DIR__ fragment sub __DIR__ () { File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]); } builder { enable 'Static', path => sub { m!\.(js|css|png)$! && s!^/gitweb/!! }, root => __DIR__."/"; Plack::App::WrapCGI->new(script => __DIR__."/gitweb.cgi")->to_app; } __END__ -- >8 -- Thanks to the she-bang line (I don't have plackup installed globally, but it is in my $PATH) I can just run ./gitweb.psgi to start server (http://0:5000/) with gitweb running. -- Jakub Narebski Poland -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html