about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-26 02:11:02 +0000
committerEric Wong <e@80x24.org>2023-11-26 19:34:55 +0000
commitef94b82e4b9f89d543b005fcf8c7f184db87c4f9 (patch)
tree78195544a3cda7b3987660cd0aa3a2f2aa93c36c /lib/PublicInbox
parentb3a13a6f051202caaa4b71cc8dc3510544b8d05c (diff)
downloadpublic-inbox-ef94b82e4b9f89d543b005fcf8c7f184db87c4f9.tar.gz
This also reduces repetition in the setup code.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/XapClient.pm4
-rw-r--r--lib/PublicInbox/XapHelperCxx.pm1
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/PublicInbox/XapClient.pm b/lib/PublicInbox/XapClient.pm
index 1f9ddccc..4dcbbe5d 100644
--- a/lib/PublicInbox/XapClient.pm
+++ b/lib/PublicInbox/XapClient.pm
@@ -28,12 +28,10 @@ sub mkreq {
 sub start_helper {
         my @argv = @_;
         socketpair(my $sock, my $in, AF_UNIX, SOCK_SEQPACKET, 0);
-        require PublicInbox::XapHelperCxx;
         my $cls = 'PublicInbox::XapHelperCxx';
         my $env;
-        my $cmd = eval { PublicInbox::XapHelperCxx::cmd() };
+        my $cmd = eval "require $cls; ${cls}::cmd()";
         if ($@) { # fall back to Perl + XS|SWIG
-                require PublicInbox::XapHelper;
                 $cls = 'PublicInbox::XapHelper';
                 # ensure the child process has the same @INC we do:
                 $env = { PERL5LIB => join(':', @INC) };
diff --git a/lib/PublicInbox/XapHelperCxx.pm b/lib/PublicInbox/XapHelperCxx.pm
index b1deb665..f421c7bc 100644
--- a/lib/PublicInbox/XapHelperCxx.pm
+++ b/lib/PublicInbox/XapHelperCxx.pm
@@ -110,6 +110,7 @@ sub check_build () {
 
 # returns spawn arg
 sub cmd {
+        die 'PI_NO_CXX set' if $ENV{PI_NO_CXX};
         check_build();
         my @cmd;
         if (my $v = $ENV{VALGRIND}) {