From 003b102efec28f52e8e4dbb0191d0f404f85fb7c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 27 Jul 2023 21:18:55 +0000 Subject: [PATCH] clone: allow running without DBI / DBD::SQLite Due to historic reasons, LeiQuery.pm gets loaded with LEI.pm and -clone depends on LEI. So delay loading any DBI-dependent modules until querying is actually required. --- lib/PublicInbox/LeiQuery.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index 3337e5d46..26cfb3fdc 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -4,9 +4,7 @@ # handles "lei q" command and provides internals for # several other sub-commands (up, lcat, ...) package PublicInbox::LeiQuery; -use strict; -use v5.10.1; -use PublicInbox::OverIdx; +use v5.12; sub prep_ext { # externals_each callback my ($lxs, $exclude, $loc) = @_; @@ -18,6 +16,7 @@ sub _start_query { # used by "lei q" and "lei up" require PublicInbox::LeiOverview; PublicInbox::LeiOverview->new($self) or return; my $opt = $self->{opt}; + require PublicInbox::OverIdx; # loads DBI PublicInbox::OverIdx::fork_ok($opt); my ($xj, $mj) = split(/,/, $opt->{jobs} // ''); (defined($xj) && $xj ne '' && $xj !~ /\A[1-9][0-9]*\z/) and -- 2.47.2