]> Sergey Matveev's repositories - public-inbox.git/blobdiff - public-inbox.cgi
mda: remove unnecessary import
[public-inbox.git] / public-inbox.cgi
index 5c6dfe8a3c5a298ba3b7f4591c4dce0223b041b8..75d510c092b284a685f7158566dadf4029e354d6 100755 (executable)
@@ -4,13 +4,16 @@
 use strict;
 use warnings;
 use IO::Handle;
-require PublicInbox::WWW;
+use PublicInbox::WWW;
 use CGI qw/-nosticky/;
 our $NO_SCRIPT_NAME;
 our %HTTP_CODES;
 BEGIN {
        $NO_SCRIPT_NAME = 1 if $ENV{NO_SCRIPT_NAME};
-       CGI->compile if $ENV{MOD_PERL};
+       if ($ENV{MOD_PERL}) {
+               CGI->compile;
+               PublicInbox::WWW->preload;
+       }
 
        %HTTP_CODES = (
                200 => 'OK',
@@ -32,16 +35,13 @@ my $ret = PublicInbox::WWW::run($req, $req->request_method);
 
 my $out = select;
 $out->binmode;
-if (@ARGV && $ARGV[0] eq 'static') {
-       $out->write($ret->[2]->[0]); # only show the body
-} else { # CGI
-       if (ref($ret) eq 'CODE') {
-               $ret->(*dump_header);
-       } else {
-               my ($status, $headers, $body) = @$ret;
 
-               dump_header([$status, $headers])->write($body->[0]);
-       }
+if (ref($ret) eq 'CODE') {
+       $ret->(*dump_header);
+} else {
+       my ($status, $headers, $body) = @$ret;
+
+       dump_header([$status, $headers])->write($body->[0]);
 }
 
 sub dump_header {