diff options
author | Eric Wong <e@yhbt.net> | 2020-01-10 08:49:31 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-01-11 21:16:26 +0000 |
commit | 62f28026e624ed30d620063a0fa92cbedb7f6673 (patch) | |
tree | 8cdd2a4646c3304e5a6072e824fe5da2aa05eea8 /script | |
parent | f018d5cc70f3a6983e4ec188ae62a729a8b31157 (diff) | |
download | public-inbox-62f28026e624ed30d620063a0fa92cbedb7f6673.tar.gz |
Some users just want to run -mda, -watch, and/or -nntpd. Let them run just those without forcing them to pull in a bunch of dependencies.
Diffstat (limited to 'script')
-rwxr-xr-x | script/public-inbox-httpd | 15 | ||||
-rwxr-xr-x | script/public-inbox.cgi | 15 |
2 files changed, 18 insertions, 12 deletions
diff --git a/script/public-inbox-httpd b/script/public-inbox-httpd index b2464f4e..09da505e 100755 --- a/script/public-inbox-httpd +++ b/script/public-inbox-httpd @@ -1,15 +1,18 @@ #!/usr/bin/perl -w -# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org> +# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org> # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> # # Standalone HTTP server for public-inbox. use strict; -use warnings; -use Plack::Util; use PublicInbox::Daemon; -use PublicInbox::HTTP; -use PublicInbox::HTTPD; -use Plack::Builder; +BEGIN { + for (qw(Plack::Builder Plack::Util)) { + eval("require $_") or die "E: Plack is required for $0\n"; + } + Plack::Builder->import; + require PublicInbox::HTTP; + require PublicInbox::HTTPD; +} my %httpds; my $app; my $refresh = sub { diff --git a/script/public-inbox.cgi b/script/public-inbox.cgi index c0e8e6c3..c766483a 100755 --- a/script/public-inbox.cgi +++ b/script/public-inbox.cgi @@ -1,14 +1,17 @@ #!/usr/bin/perl -w -# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org> +# Copyright (C) 2014-2020 all contributors <meta@public-inbox.org> # License: AGPL-3.0+ or later <https://www.gnu.org/licenses/agpl-3.0.txt> # # Enables using PublicInbox::WWW as a CGI script use strict; -use warnings; -use Plack::Builder; -use Plack::Handler::CGI; -use PublicInbox::WWW; -BEGIN { PublicInbox::WWW->preload if $ENV{MOD_PERL} } +BEGIN { + for (qw(Plack::Builder Plack::Handler::CGI)) { + eval("require $_") or die "E: Plack is required for $0\n"; + } + Plack::Builder->import; + require PublicInbox::WWW; + PublicInbox::WWW->preload if $ENV{MOD_PERL}; +} my $www = PublicInbox::WWW->new; my $have_deflater = eval { require Plack::Middleware::Deflater; 1 }; my $app = builder { |