From e2ed3be62fbb53e16a9248a408a7a069a05842e6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 11 Sep 2015 05:42:40 +0000 Subject: [PATCH] examples/public-inbox.psgi: optional deflater The deflater middleware isn't standard Plack, so don't require potential users install it. --- examples/public-inbox.psgi | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/public-inbox.psgi b/examples/public-inbox.psgi index 1de5bb7d..b0b9ae98 100644 --- a/examples/public-inbox.psgi +++ b/examples/public-inbox.psgi @@ -9,10 +9,14 @@ use PublicInbox::WWW; PublicInbox::WWW->preload; use Plack::Request; use Plack::Builder; +my $have_deflater = eval { require Plack::Middleware::Deflater; 1 }; + builder { - enable "Deflater", - content_type => [ 'text/html', 'text/plain', - 'application/atom+xml' ]; + if ($have_deflater) { + enable "Deflater", + content_type => [ 'text/html', 'text/plain', + 'application/atom+xml' ]; + } enable "Head"; sub { my $req = Plack::Request->new(@_); -- 2.44.0