From b79559bb07595e5e29f45d5791bfb53cb6f6a06b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 28 Apr 2014 22:09:30 +0000 Subject: cgi: make CGI optional for Plack users CGI.pm is on its way out, so do not make it a hard requirement for Plack users. We still support CGI-only installations because some sysadmins and distros may be very conservative. --- public-inbox.cgi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'public-inbox.cgi') diff --git a/public-inbox.cgi b/public-inbox.cgi index 54ff0159..93147124 100755 --- a/public-inbox.cgi +++ b/public-inbox.cgi @@ -12,7 +12,6 @@ use 5.008; use strict; use warnings; -use CGI qw(:cgi -nosticky); # PSGI/FastCGI/mod_perl compat use PublicInbox::Config; use URI::Escape qw(uri_escape_utf8 uri_unescape); our $LISTNAME_RE = qr!\A/([\w\.\-]+)!; @@ -21,6 +20,8 @@ BEGIN { $pi_config = PublicInbox::Config->new; # TODO: detect and reload config as needed if ($ENV{MOD_PERL}) { + require CGI; + $CGI::NOSTICKY = 1; CGI->compile; } } @@ -32,6 +33,7 @@ if ($ENV{PI_PLACKUP}) { # which confuses CGI.pm when generating self_url. # RFC 3875 does not mention REQUEST_URI at all, # so nuke it since CGI.pm functions without it. + require CGI; delete $ENV{REQUEST_URI}; my $req = CGI->new; my $ret = main($req, $req->request_method); -- cgit v1.2.3-24-ge0c7