From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A194B633805 for ; Sat, 5 Mar 2016 21:02:48 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] httpd: remove unnecessary eval Date: Sat, 5 Mar 2016 21:02:48 +0000 Message-Id: <20160305210248.24890-1-e@80x24.org> List-Id: We have per-middleware evals to deal with them being missing; no need to put an eval around the whole thing and use an extra level of indentation. --- script/public-inbox-httpd | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/script/public-inbox-httpd b/script/public-inbox-httpd index b6c4e67..e7ed3c9 100755 --- a/script/public-inbox-httpd +++ b/script/public-inbox-httpd @@ -23,28 +23,26 @@ my $refresh = sub { require PublicInbox::WWW; PublicInbox::WWW->preload; my $www = PublicInbox::WWW->new; - $app = eval { - builder { - enable 'Chunked'; - eval { - enable 'Deflater', - content_type => [ qw( - text/html - text/plain - application/atom+xml - )] - }; - $@ and warn + $app = builder { + enable 'Chunked'; + eval { + enable 'Deflater', + content_type => [ qw( + text/html + text/plain + application/atom+xml + )] + }; + $@ and warn "Plack::Middleware::Deflater missing, bandwidth will be wasted\n"; - eval { enable 'ReverseProxy' }; - $@ and warn + eval { enable 'ReverseProxy' }; + $@ and warn "Plack::Middleware::ReverseProxy missing,\n", "URL generation for redirects may be wrong if behind a reverse proxy\n"; - enable 'Head'; - sub { $www->call(@_) }; - }; + enable 'Head'; + sub { $www->call(@_) }; }; } }; -- EW