]> Sergey Matveev's repositories - public-inbox.git/commitdiff
www: avoid BEGIN block for config loading
authorEric Wong <e@80x24.org>
Sun, 30 Aug 2015 10:12:54 +0000 (10:12 +0000)
committerEric Wong <e@80x24.org>
Sun, 30 Aug 2015 10:12:54 +0000 (10:12 +0000)
It fails the syntax check if a user does not have
~/.public-inbox/config setup.  Anyways we can safely
use ||= on a global since we do not support threads.

lib/PublicInbox/WWW.pm

index a01271b1c9291460a86f8011470e83f4ad770ac9..e6eec3d60ed567d974c300819bff37eb6e1aba62 100644 (file)
@@ -17,12 +17,10 @@ use constant SSOMA_URL => 'http://ssoma.public-inbox.org/';
 use constant PI_URL => 'http://public-inbox.org/';
 our $LISTNAME_RE = qr!\A/([\w\.\-]+)!;
 our $pi_config;
-BEGIN {
-       $pi_config = PublicInbox::Config->new;
-}
 
 sub run {
        my ($cgi, $method) = @_;
+       $pi_config ||= PublicInbox::Config->new;
        my %ctx = (cgi => $cgi, pi_config => $pi_config);
        if ($method !~ /\AGET|HEAD\z/) {
                return r(405, 'Method Not Allowed');